[Rcpp-devel] Concatenating NumericVectors

Martin Oberhuber martinoberhuber at gmail.com
Wed Aug 22 03:38:04 CEST 2012


Dear Rcpp Users,

I would like to concatenate two NumericVectors. For instance:

...
NumericVector a( some_STL_vector ) ;
NumericVector b( some_STL_vector ) ;

...  // using Rcpp sugar on a and b

a.insert( a.end(), b.begin(), b.end() );

... // using Rcpp sugar on a



This would work fine if a and be were of type std::vector<double>. However,
NumericVector does not seem to have an insert function which supports the
structure above and therefore this isn't working.

Any ideas on how I could concatenate the two vectors using a different
methodology? The reason I would like to use NumericVectors here is because
I am using Rcpp sugar on a and b and the resulting concatenated vector and
I would like to avoid converting them back and forth between std::vector
and NumericVector.

Thanks,

Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20120821/e73c24ae/attachment.html>


More information about the Rcpp-devel mailing list