[Rcpp-devel] Rcpp::List::create(...) with more than 20 elements ?
Dominique Belhachemi
domibel at debian.org
Wed Apr 17 17:45:51 CEST 2013
Thanks Romain and Dirk,
I just implemented those alternatives and it is working now.
-Dominique
On Wed, Apr 17, 2013 at 10:11 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> On 17 April 2013 at 09:54, Dominique Belhachemi wrote:
> | Hi everyone,
> |
> | I am porting some code from the old API to the new API like in the
> following
> | example.
> |
> | - SEXP ret = R_NilValue;
> | - RcppResultSet rs;
> | - rs.add("foo1", bar1);
> | - rs.add("foo2", bar2);
> | - ret = rs.getReturnList();
> |
> | + SEXP ret = R_NilValue;
> | + ret = Rcpp::List::create(Rcpp::Named("foo1") = bar1
> | +
> | Rcpp::Named("foo2") = bar2);
> |
> | This works well if I have less than 20 elements.
>
> There is a limit to the auto-generated constructors. This has been
> discussed
> a few times before on the list -- try the gmane.org archive (which you can
> use as an argument to site: to focus google queries).
>
> | But how can I add new elements to the list, including assigning names ?
> | Is there an alternative way to create the list without using
> Rcpp::List::create
> | ?
>
> Recurse:
>
> stick 20 elements into list 1,
> stick another 20 into list 2,
> ....
> stick list 1, list 2, ... into bigList
> return bigList
>
> Dirk
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130417/2658fe8f/attachment.html>
More information about the Rcpp-devel
mailing list