<div dir="ltr"><div><div>Thanks Romain and Dirk,<br><br></div>I just implemented those alternatives and it is working now.<br><br></div>-Dominique<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 17, 2013 at 10:11 AM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On 17 April 2013 at 09:54, Dominique Belhachemi wrote:<br>
| Hi everyone,<br>
|<br>
| I am porting some code from the old API to the new API like in the following<br>
| example.<br>
|<br>
| -      SEXP ret = R_NilValue;<br>
| -      RcppResultSet rs;<br>
| -      rs.add("foo1", bar1);<br>
| -      rs.add("foo2", bar2);<br>
| -      ret = rs.getReturnList();<br>
|<br>
| +     SEXP ret = R_NilValue;<br>
| +     ret = Rcpp::List::create(Rcpp::Named("foo1")  = bar1<br>
| +                                      <br>
| Rcpp::Named("foo2")  = bar2);<br>
|<br>
| This works well if I have less than 20 elements.<br>
<br>
</div>There is a limit to the auto-generated constructors.  This has been discussed<br>
a few times before on the list -- try the <a href="http://gmane.org" target="_blank">gmane.org</a> archive (which you can<br>
use as an argument to site: to focus google queries).<br>
<div class="im"><br>
| But how can I add new elements to the list, including assigning names ?<br>
| Is there an alternative way to create the list without using Rcpp::List::create<br>
| ?<br>
<br>
</div>Recurse:<br>
<br>
          stick 20 elements into list 1,<br>
          stick another 20 into list 2,<br>
          ....<br>
          stick list 1, list 2, ...  into bigList<br>
          return bigList<br>
<span class="HOEnZb"><font color="#888888"><br>
Dirk<br>
<br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
</font></span></blockquote></div><br></div>