<div dir="ltr">Maybe we need a DataFrameBuilder class that someone could use like so:<br><br>    DataFrame df = DataFrameBuilder::create()<br>        .add("column 1", col1)<br>        .add("column 2", col2)<br>
        .add("column 3", col3);<br>        <br>This could be made as a generic VectorBuilder<T> class as well.<div><br></div><div>Or maybe I've been writing too much Java lately...<br><br>Cheers,<br>Kevin</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 8, 2014 at 2:43 PM, Steffen Neumann <span dir="ltr"><<a href="mailto:sneumann@ipb-halle.de" target="_blank">sneumann@ipb-halle.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
thanks for the quick answer. I didn't find how to *easily*<br>
populate my list with named elements without fiddling<br>
with the names attribute, so I ended up creating<br>
two dataframes and then cbinding them from within C++<br>
<br>
Rcpp::Language("cbind", allScanHeaderInfo, allScanHeaderInfo2).eval() ;<br>
<br>
Yours,<br>
Steffen<br>
<div class="im HOEnZb"><br>
On Di, 2014-07-08 at 11:17 -0500, Dirk Eddelbuettel wrote:<br>
> On 8 July 2014 at 17:51, Steffen Neumann wrote:<br>
> | Hi,<br>
> |<br>
> | I (think I) need to create a DataFrame with more than 20 entries,<br>
> | because I want another slot in this file:<br>
> | <a href="https://github.com/sneumann/mzR/blob/master/src/RcppRamp.cpp#L221" target="_blank">https://github.com/sneumann/mzR/blob/master/src/RcppRamp.cpp#L221</a><br>
> |<br>
> | I stumbled upon a 2year old answer here:<br>
> |<br>
> | <a href="http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2013-March/005430.html" target="_blank">http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2013-March/005430.html</a><br>
> |<br>
> | Questions:<br>
> |<br>
> | 1) Should I avoid DataFrame here in first place ? I'd love to keep it<br>
> | 2) Is there a more elegant solution for >20 entries by now ?<br>
> | 3a) How do I create the mentioned "local header file with 21, 22, 23, ... \infty arguments as you need it."<br>
> | 3b) How and where do I #include that ? I need to fake a directory structure<br>
> |     so that <Rcpp/DataFrame.h> picks up my version of #include <Rcpp/generated/DataFrame_generated.h> ?<br>
> | 4) Is that future proof ?!<br>
><br>
> No.<br>
><br>
> Can you 'fudge it' and just create a List with N elements, each containing a<br>
> DataFrame of 10 columns?  You can then find them in R at the end ...<br>
><br>
> Come to think of it, a DataFrame is _almost_ the same as a list, so I would<br>
> just create a List with your desired 20+ elements and then just call<br>
> as.data.frame() on it.<br>
><br>
> Or in case all entries are numeric (you didn't say..) just take a matrix...<br>
><br>
> Dirk<br>
><br>
<br>
<br>
--<br>
</div><div class="HOEnZb"><div class="h5">IPB Halle                    AG Massenspektrometrie & Bioinformatik<br>
Dr. Steffen Neumann          <a href="http://www.IPB-Halle.DE" target="_blank">http://www.IPB-Halle.DE</a><br>
Weinberg 3                   <a href="http://msbi.bic-gh.de" target="_blank">http://msbi.bic-gh.de</a><br>
06120 Halle                  Tel. <a href="tel:%2B49%20%280%29%20345%205582%20-%201470" value="+4934555821470">+49 (0) 345 5582 - 1470</a><br>
                                  <a href="tel:%2B49%20%280%29%20345%205582%20-%200" value="+4934555820">+49 (0) 345 5582 - 0</a><br>
sneumann(at)IPB-Halle.DE     Fax. <a href="tel:%2B49%20%280%29%20345%205582%20-%201409" value="+4934555821409">+49 (0) 345 5582 - 1409</a><br>
</div></div><br>_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br></blockquote></div><br></div>