[Rcpp-devel] Good idioms for creating a named list?

Douglas Bates bates at stat.wisc.edu
Mon Mar 15 21:13:24 CET 2010


R functions often return a named list, sometimes with an S3 class
attached.  Over the weekend I exchanged some email with Dirk and
Romain about good ways to create such a return object.  The way that I
am currently doing so is through creating an Rcpp::Pairlist of
Rcpp::Named objects then converting the Pairlist to a List.

Another possibility would be to create a

std::map<std::string, Rcpp::Robject>

add components to the map and wrap the result.  I can check for
myself, of course, but can someone tell me off the bat what the form
of the R object resulting from Rcpp::wrap applied to such an object
would be?


More information about the Rcpp-devel mailing list