[Rcpp-devel] Using older RInside/Rcpp without operator[]?

Matthew Levinson mlevinson at stat.ucla.edu
Fri Jul 8 23:10:48 CEST 2011

I use RInside and Rcpp packages to make a few R calls from C++ for a
bioinformatics project I'm doing.  I'm trying to get my code working on a
big cluster on campus to speed up the analysis I need to do on real data now
that my methodological development is done.  The admins for that cluster
were only able to get RInside 0.2.1, and I think Rcpp 0.7.9 (maybe 0.7.8?)
compiled properly.  This has meant that operator[] has disappeared.

I was setting up my R instance with the standard:

RInside R(0, NULL);

And then was creating Rcpp::NumericVector instances, filling them, then

R["var.name"] = my_numeric_vector;

How do I accomplish this assignment in the older versions?  I've been
looking through the header files at the assign functions, but:

R.assign(my_numeric_vector, "var.name");

doesn't work, as there are only assign functions defined to take standard
STL vectors as the thing to be assigned to the given variable name in the R
instance.  Do I have to rewrite the code so the NumericVector instances are
just std::vector<double> instances?  Is there some other function other than
the assign functions that I can use?  Is there a built in function in
NumericVector to cast it to a STL vector of doubles?

I really appreciate the vast work you've put into this package.  It's saved
my butt a few times!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110708/677b6ac1/attachment.htm>

More information about the Rcpp-devel mailing list