[Rcpp-devel] Transform arbitrary R object into std::vector<vector<double>>

Dirk Eddelbuettel edd at debian.org
Thu May 19 14:54:29 CEST 2016


On 19 May 2016 at 12:47, Paul Saary wrote:
| Thank you for your reply,
| 
| > If you always use vector< vector< double > > then I would start with
| > Rcpp::NumericMatrix, or arma::mat.
| 
| The problem is, that I want to offer the user a choice of using also
| data.frames and not just Matrices. So I can not really decide, with what
| I start, or am I wrong?

Yes :)

A data.frame is simply not a matrix. It allows different types. Which you
cannot represent here.
 
| Regarding the use of Rcpp:function:
| As the R objects used are very large (many MB to some GB), I would like
| to do the transformation into a usable format, in my case into the
| vector< vector< double > >, in CPP, as I imagine it to be much faster.

Imagination can be a dangerous thing. Most of us prefer profiling.
 
| I will have look into armadillo, but I hoped to avoid loading another
| library, to reduce the depencies of my script/package.

Please do look into it. It is worth it. And the added size, relative to the
footprint you already have with R, is marginal.  And there is none at
run-time -- C++ and all that.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list