[Rcpp-devel] Maximum Columns in Rcpp DataFrame (revisited)

Dirk Eddelbuettel edd at debian.org
Tue Jul 8 18:17:25 CEST 2014

On 8 July 2014 at 17:51, Steffen Neumann wrote:
| Hi,
| I (think I) need to create a DataFrame with more than 20 entries,
| because I want another slot in this file:
| https://github.com/sneumann/mzR/blob/master/src/RcppRamp.cpp#L221
| I stumbled upon a 2year old answer here:
| http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2013-March/005430.html
| Questions: 
| 1) Should I avoid DataFrame here in first place ? I'd love to keep it
| 2) Is there a more elegant solution for >20 entries by now ?
| 3a) How do I create the mentioned "local header file with 21, 22, 23, ... \infty arguments as you need it."
| 3b) How and where do I #include that ? I need to fake a directory structure 
|     so that <Rcpp/DataFrame.h> picks up my version of #include <Rcpp/generated/DataFrame_generated.h> ?
| 4) Is that future proof ?!


Can you 'fudge it' and just create a List with N elements, each containing a
DataFrame of 10 columns?  You can then find them in R at the end ...

Come to think of it, a DataFrame is _almost_ the same as a list, so I would
just create a List with your desired 20+ elements and then just call
as.data.frame() on it.

Or in case all entries are numeric (you didn't say..) just take a matrix...


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

More information about the Rcpp-devel mailing list