[Rcpp-devel] nested lists into Rcpp
David García Callejas
david.garcia.callejas at gmail.com
Sun Mar 17 21:36:55 CET 2013
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.
Thank you in advance
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130317/8bb9f6ed/attachment.html>
More information about the Rcpp-devel
mailing list