[Rcpp-devel] clang does not like lists with a DataFrame inside?
Ramon Diaz-Uriarte
rdiaz02 at gmail.com
Tue Dec 5 17:49:31 CET 2017
On Tue, 28-November-2017, at 00:24:33, Dirk Eddelbuettel <edd at debian.org> wrote:
> On 28 November 2017 at 00:03, Ramon Diaz-Uriarte wrote:
> | Hi Dirk,
> |
> |
> | On Mon, 27-November-2017, at 14:14:09, Dirk Eddelbuettel <edd at 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 :)
I am going to store this safely to remind myself of the (many) advantages
of no longer being so young ;-)
Best,
R.
>
> 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
--
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-25
Facultad de Medicina
Universidad Autónoma de Madrid
Arzobispo Morcillo, 4
28029 Madrid
Spain
Phone: +34-91-497-2412
Email: rdiaz02 at gmail.com
ramon.diaz at iib.uam.es
http://ligarto.org/rdiaz
More information about the Rcpp-devel
mailing list