Rcpp icon indicating copy to clipboard operation
Rcpp copied to clipboard

feature request: parse LogicalVector C++ default arguments into R equivalents

Open klin333 opened this issue 2 years ago • 1 comments

Hi,

According to https://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-attributes.pdf, not all C++ default argument values can be parsed into their R equivalents, but Rcpp can handle CharacterVector, IntegerVector, and NumericVector instantiated using the ::create static member function.

This is a feature request to also allow LogicalVector::create. The current work around I use is to use cpp_func(arg=IntegerVector::create(1, 0)) instead of the more desirable =LogicalVector::create(true, false).

klin333 avatar May 09 '22 02:05 klin333

Hm, not unreasonable but I have somewhere in the back of my head a notion that the fact that R has three values for boolean (namely true, false and na) whereas standard bool only has two as a stumbling block.

I don't think anybody has poked in that corner of the code in a while. Maybe it is doable with a simple templated specialisation, or maybe it is more involved all the way to near impossible. Do you want to take a poke?

eddelbuettel avatar May 09 '22 03:05 eddelbuettel

This issue is stale (365 days without activity) and will be closed in 31 days unless new activity is seen. Please feel free to re-open it is still a concern, possibly with additional data.

github-actions[bot] avatar May 13 '23 02:05 github-actions[bot]