Quick ones:
a) Yes, there are but I am not sure they are vectorised. But some templated NA traits were added.
b) Yes as e.g. in
R> cppFunction('double mymax(NumericVector x) { \
IntegerVector x2 = wrap(na_omit(x)); \
return max(x2);}')
R> mymax(c(1L, 2L, NA, 4L))
[1] 4
R>
c) Integer always gets 'cast up' to Numeric at the cost of a copy.
@Roland already hinted at na_omit
. In b), somehow I need to help with a wrap()
to generate an intermediate SEXP
object.