[Rcpp-devel] Subsetting / slicing with Vectors

Kevin Ushey kevinushey at gmail.com
Sat Jan 12 20:10:03 CET 2013


Hi guys,

I'm wondering -- what operations are available for subsetting of Vectors in
Rcpp? I've scoured through all the vignettes but it seems like a couple
'nice-to-haves' aren't there yet. My questions:

* is there a difference between subsetting a vector with () vs []?

* is it possible to subset based on a collection of indices, eg:

NumericVector X(10);
NumericVector Y = X[ c(1, 2, 5) ]

* is it possible to slice a vector, eg. such that we either hold a
reference to, or copy out, the elements at every 'x' indices? I know 'seq'
is available for consecutive indices, but might there be a third 'by'
argument coming, or an alternative function, soon?

Thanks for the help,
-Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130112/b909a268/attachment.html>


More information about the Rcpp-devel mailing list