Message-ID: <20806.12187.622670.444665@max.nulle.part>
Date: 2013-03-17T21:03:23Z
From: Dirk Eddelbuettel
Subject: [Rcpp-devel] nested lists into Rcpp
In-Reply-To: <CACuAxDkTbNw2=ZMVpLJ6Wwg9MuHcCNGDsRnT4FfkiPEumCuJqg@mail.gmail.com>
On 17 March 2013 at 21:36, David Garc?a Callejas wrote:
| Hi all,?
|
| this is my first question here:
|
| I have in R a list with several elements, some of them are lists, in the vein
| of this:
|
| mylist <- vector("list",10)
| for(m in 1:10){
| ? mylist[[m]]$ID <- m
| ? mylist[[m]]$num <-?vector("list",5)
| ? mylist[[m]]$num2 <-?vector("list",5)
| }
|
| Is there a way to pass a data structure like this to a Rcpp function, convert
| it to an appropriate C++ structure, and after doing some work with it, return
| it in its original form?
|
| fun <- cxxfunction(signature(x='List'), plugin='Rcpp', body = ' ?
| ?using namespace std;
| ? List templist(x);
| ? //operations...
| ? return(wrap(templist));
| ? ?') ??
|
| Surely I am missing something obvious here, but I am just arrived to Rcpp, and
| after looking in the documentation, I haven't found anything similar.?
There are working example in the RcppExamples packages -- and you need to
look at the C++ sources, obviously -- that do this.
Dirk
| Thank you in advance
| David
|
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com