[Rcpp-devel] Boolean vector from R to C++
romain at r-enthusiasts.com
romain at r-enthusiasts.com
Thu Apr 14 17:18:31 CEST 2011
Yes. LogicalVector.
Le 14 avr. 2011 à 05:00 PM, Cedric Ginestet <c.ginestet05 at googlemail.com> a écrit :
> Hi all,
>
> I am trying to pass on a boolean vector from R to C++. I have naively tried the following:
>
> ################################
> src <- '
> using namespace Rcpp ;
> using namespace std ;
> int b = as<bool>(xb);
> return wrap(b);'
> cxxfun <- cxxfunction(sig=signature(xb="logical"),
> body=src,plugin="Rcpp",verbose=TRUE)
> cxxfun(b);
>
> Error in cxxfun(b) : expecting a single value
> ###############################
>
> Is there an equivalent to IntegerVector or NumericVector for Boolean variables or can I simply use the Rcpp::Vector template for this purpose?
>
> Thanks for your help,
>
>
> --
> Cedric Ginestet
> Centre for Neuroimaging Sciences (L3.04)
> NIHR Biomedical Research Centre
> Department of Neuroimaging
> Institute of Psychiatry, Box P089
> King's College London
> De Crespigny Park
> London
> SE5 8AF
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110414/f202de1c/attachment.htm>
More information about the Rcpp-devel
mailing list