Dear all,

I have a (small) vector "r" containing values and a (large) vector
"index" containing indices. Is there an easy way to select the elements of
"r" that are indexed by "index"?

I.e., is there a way to reproduce the following R code with Rcpp (without
using loops)?

r <- c(1,11,111)
index <- c(2,2,1)
r[index]

Thanks in advance,
/g
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to