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

Dirk Eddelbuettel edd at debian.org
Fri Jul 8 23:33:51 CEST 2011

On 8 July 2011 at 14:10, Matthew Levinson wrote:
| 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

Could you get the admins to update, please?  Maybe by helping them by letting
us know what errors they are getting?

[ stats at UCLA is funny as Jan often comes up with errors due to
  bleeding-edge compilers on OS X :) ]

| 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 doing:
| R["var.name"] = my_numeric_vector;
| How do I accomplish this assignment in the older versions?  I've been looking

I'd start with the corresponding examples/ directory from the version you are
using.  Those examples work with the version they ship with.

| 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

Are you sure?  I thought the very very first assign() functiones used SEXPs....

| 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?

The as<>() and wrap() functions are meant for the casting, but then again,
the most feature complete variant with be 0.9.5.  
| I really appreciate the vast work you've put into this package.  It's saved my
| butt a few times!

Glad to hear that.  Hope this helps,  Dirk
| Thanks,
| Matt
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Gauss once played himself in a zero-sum game and won $50.
                      -- #11 at http://www.gaussfacts.com

More information about the Rcpp-devel mailing list