cpp11 icon indicating copy to clipboard operation
cpp11 copied to clipboard

`as_integers` and `as_doubles` should understand logical inputs

Open vspinu opened this issue 3 years ago • 1 comments
trafficstars

Arguably logicals are also "integer like", but the main use case is the all-NA input vectors. When a user enters xyz(arg = NA) and arg is intended to be an integer the cpp level conversion with as_integers fails.

For this reason as_integers is still incomplete because we still need a custom wrapper around as_integer for logicals internally.

Would be really great if it could be done as part of #265 (cc @DavisVaughan)

vspinu avatar Nov 02 '22 15:11 vspinu

@vspinu @DavisVaughan

I implemented 25% of this. I say 25% and not 50% because I do not like the implementation as I could not find a good way to use

std::transform(xn.begin(), xn.end() ...

with logicals

here is the draft https://github.com/r-lib/cpp11/pull/426

pachadotdev avatar Dec 17 '24 07:12 pachadotdev