<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Not sure what you mean by hide the R function. You can extract a function by its name on the C++ side : <div><br></div><div>Function bazinga("mean") ;</div><div><br></div><div>or extract it from a particular environment, e.g.</div><div><br></div><div>Environment("package:base")["mean"]<br><div><div><br></div><div>or </div><div><br></div><div>Environment base("package:base") ; </div><div>Function foo = base["mean"]</div><div><br></div><div>Romain</div><div><br><div><div>Le 5 août 2014 à 09:26, super <<a href="mailto:rcppmail@163.com">rcppmail@163.com</a>> a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height: 1.7; font-size: 14px; font-family: Arial;"><div>Hello Rcppusers,</div><div>  I want to call  a  r function in Cpp code, e.g.</div><div> int  meanC( NumericVector x) {</div><div>    return mean(x,_["na.rm"]=TRUE);</div><div>}</div><div><span style="line-height: 1.7;">Here function mean is a r function not rewrittened  Rcpp version's mean. I do know one way to do this:</span></div><div><div> int  meanC( Function f,NumericVector x) {</div><div>    return f(x,<span style="line-height: 1.7;">_["na.rm"]=TRUE</span><span style="line-height: 1.7;">);</span></div><div>}</div></div><div><span style="line-height: 1.7;">Then  meanC(mean,1:3)</span></div><div><span style="line-height: 1.7;">but can i hidden the true r function called ?  Is  r functions packed into some namespace?</span></div><div><br></div><div><br></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>_______________________________________________<br>Rcpp-devel mailing list<br><a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</blockquote></div><br></div></div></div></body></html>