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@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to