[Rcpp-devel] [Rcpp] How can i call a R function in Cpp source code?

super rcppmail at 163.com
Tue Aug 5 09:26:01 CEST 2014


Hello Rcppusers,
  I want to call  a  r function in Cpp code, e.g.
 int  meanC( NumericVector x) {
    return mean(x,_["na.rm"]=TRUE);
}
Here function mean is a r function not rewrittened  Rcpp version's mean. I do know one way to do this:
 int  meanC( Function f,NumericVector x) {
    return f(x,_["na.rm"]=TRUE);
}
Then  meanC(mean,1:3)
but can i hidden the true r function called ?  Is  r functions packed into some namespace?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140805/7f82b659/attachment.html>


More information about the Rcpp-devel mailing list