Message-ID: <F07FE54B-3D7A-44FB-85AA-7B7F54A2BFC8@r-enthusiasts.com>
Date: 2011-04-14T15:18:31Z
From: Romain Francois
Subject: [Rcpp-devel] Boolean vector from R to C++
In-Reply-To: <4DA70C24.5070305@googlemail.com>
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>