On 28 November 2017 at 00:03, Ramon Diaz-Uriarte wrote: | Hi Dirk, | | | On Mon, 27-November-2017, at 14:14:09, Dirk Eddelbuettel <e...@debian.org> wrote: | > Ramon, | > | > On 27 November 2017 at 10:43, Ramon Diaz-Uriarte wrote: | > | Dear All, | > | | > | I am trying to pass to C++ an R list that contains a data frame. Using gcc | > | the following | > | | > | ############################# | > | | > | #include <Rcpp.h> | > | using namespace Rcpp; | > | | > | // [[Rcpp::export]] | > | void withDF(Rcpp::List bl) { | > | Rcpp::DataFrame df1 = bl["the_df"]; | > | > I think every existing example uses a template when extracting items from a | > list as we cannot know at compile time which run-time SEXP we will be handed. | | Aha, understood. I did not think much about it, tried with gcc, it worked, | and then was surprised to see it not work with clang.
These slight differences annoyed me at the beginning, but the advantage of getting older is that you just get generally more forgetful. "Just assume nothing works unless you are explicit about it" seems to be my current motto :) as<>() and wrap() are pretty magic. We get by with fewer very explicit statement than we used to years ago, but some remain, notably -- return statements better not be compound -- assignment from list or data.frame by name -- [ your issue here, space for rent upon request ] [...] | > I don't think so. See eg | > | > https://github.com/eddelbuettel/rcppexamples/blob/master/src/ListExample.cpp | | Thanks for that. Bookmarked for future reference :-) It's old and could be expanded but better than nothing. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel