Hi to all, I was investigating a way to write with Rcpp a function that removes all the NA values in the input vector.
And before doing so, I was playing with Rcpp, writing this function: library(inline) cppFunction(' Vector<INTSXP> na_test(const Vector<INTSXP>& x) { return setdiff(x, Vector<INTSXP>::create(::traits::get_na<INTSXP>())); } ') That works in this way: na_test(c(1, NA, NA, 1, 2, NA))# [1] 1 2 How can I write a generalized version of this function, for example? I've made an attempt (see stackoverflow related question<http://stackoverflow.com/questions/15953768/templated-rcpp-function>). It compiles but it doesn't work as expected. Any suggest or example? Thanks in advance, Leonardo Di Donato
_______________________________________________ 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