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

2014-08-05 Thread super
50:02, "Dirk Eddelbuettel" wrote: > >On 5 August 2014 at 17:30, super wrote: >| >| Yes , maybe that is very close to my needs , sorry for my pool english >| expression. But, the following code can't work: >| double meanC(NumericVector x) { >|Function m

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

2014-08-05 Thread super
nvironment, e.g. Environment("package:base")["mean"] or Environment base("package:base") ; Function foo = base["mean"] Romain Le 5 août 2014 à 09:26, super a écrit : Hello Rcppusers, I want to call a r function in Cpp code, e.g. int meanC( Numeric

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

2014-08-05 Thread super
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,