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

Steffen Neumann sneumann at ipb-halle.de
Tue Jul 8 23:43:07 CEST 2014


Hi,

thanks for the quick answer. I didn't find how to *easily* 
populate my list with named elements without fiddling 
with the names attribute, so I ended up creating
two dataframes and then cbinding them from within C++

Rcpp::Language("cbind", allScanHeaderInfo, allScanHeaderInfo2).eval() ; 

Yours,
Steffen

On Di, 2014-07-08 at 11:17 -0500, Dirk Eddelbuettel wrote:
> 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 ?!
> 
> No.
> 
> 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...
> 
> Dirk
> 


-- 
IPB Halle                    AG Massenspektrometrie & Bioinformatik
Dr. Steffen Neumann          http://www.IPB-Halle.DE
Weinberg 3                   http://msbi.bic-gh.de
06120 Halle                  Tel. +49 (0) 345 5582 - 1470
                                  +49 (0) 345 5582 - 0
sneumann(at)IPB-Halle.DE     Fax. +49 (0) 345 5582 - 1409
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140708/c2271bd6/attachment.sig>


More information about the Rcpp-devel mailing list