On 5 January 2012 at 07:41, Gregor Kastner wrote:
| 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]

That was just discussed _yesterday_ on this list.

And no, I don't think it is. Would be nice -- patches welcome.

Dirk

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx
_______________________________________________
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