<div dir="ltr">Yup, that example is really helpful. Note that if you do:<div><br></div><div>  the_list.attr("row.names") = IntegerVector::create(NA_INTEGER, -nrow);<br></div><div><br></div><div>it will create implicit row names from 1:nrow. The number of rows must be negative.</div>

<div><br></div><div>THK</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jun 8, 2014 at 8:03 PM, Dmitry Nesterov <span dir="ltr"><<a href="mailto:dmitry.nesterov@gmail.com" target="_blank">dmitry.nesterov@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dirk,<br>
The example that you provided in the link to the Rcpp Gallery has been very helpful.<br>
Thank you for pointing it out, it did speed up my data frame creation code significantly.<br>
It allows me to use Rcpp where I used C api and keep practically the same speed of execution.<br>
<br>
Best, Dmitry<br>
<div class="HOEnZb"><div class="h5">On Jun 8, 2014, at 6:42 PM, Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>> wrote:<br>
<br>
><br>
> On 8 June 2014 at 13:33, Christian Gunning wrote:<br>
> | Hello list, long time no see!<br>
><br>
> Indeed :)<br>
><br>
> | Dmitry,<br>
> | Have you identified any other consequences than what Romain pointed<br>
> | out?  This information would be useful for the rest of us.<br>
> |<br>
> | Some key points that I agree with:<br>
> |  * as per Dirk: this is a nice little piece of sleuthing.  Your<br>
> | benchmarking shows that the effect is significant.<br>
> |  * as per your comments: a key intent of Rcpp is allow the user the<br>
> | freedom to acheive optimization and do their own error checking.<br>
> |   * as per Romain: let's not break things.<br>
> |<br>
> | It seems possible address all of these points, perhaps with a<br>
> | dedicated function, as per your comments.  I can help with this, if<br>
> | you're interested.<br>
><br>
> Also note the exisiting 'faster data.frame creation from lists' article at<br>
> the Rcpp Gallery:<br>
><br>
>  <a href="http://gallery.rcpp.org/articles/faster-data-frame-creation/" target="_blank">http://gallery.rcpp.org/articles/faster-data-frame-creation/</a><br>
><br>
> I only looked at it briefly in this context, and it seems that some changes<br>
> we made to Rcpp since this Gallery post was written make its suggestion a<br>
> little less dramatic.  But I did not have time to dig deeper.<br>
><br>
> But your point two here is key:  Rcpp is a _framework_ and users are of<br>
> course free to add little helper functions at their end -- and even<br>
> encouraged to do so.  Not everything has to happen at the Rcpp side of things.<br>
><br>
> | Key question: what is the intended behavior of this function?  E.g.,<br>
> | throw an exception on length mismatch?  My vote is for a limited<br>
> | function that deals with a limited number of use cases and provides<br>
> | reasonable error-checking (e.g. throws exception for input outside<br>
> | scope), versus a logic-heavy function that handles recycling, for<br>
> | example.  Does this match your use-case?<br>
><br>
> Good ideas.<br>
><br>
> Dirk<br>
><br>
> --<br>
> <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a><br>
<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><a href="http://www.keittlab.org/" target="_blank">http://www.keittlab.org/</a></div>
</div>