Skip to content
Prev 5506 / 10988 Next

[Rcpp-devel] hash

Can anyone give me an example of how to use hash table to do joins? For
example,

a <- matrix(c(1:14), ncol = 2, dimnames = list(NULL, c('id','value')))
b <- matrix(0, ncol = 2, nrow = 30, dimnames = list(NULL, c('id', 'value')))
b[,1] <- sample(c(1:7), size = 30, replace = T)

I need to populate b[,2] with the values in a[,2] by matching b[,1] and
a[,1]. Does anyone know how I can do this by using hash table in Rcpp?
Thank you.