[R] Export a function from RCPP in R of type double

Dirk Eddelbuettel edd at debian.org
Thu Jun 2 17:30:55 CEST 2011


On 2 June 2011 at 01:27, arvanitis wrote:
| I have written a small c++ function of type double function(double,double);
| and i want to export it in R using RCPP. After some trials i have realized

Rcpp uses the .Call() interface which imposes 'SEXP function(SEXP, SEXP, ...);

Please see 'Writing R Extensions' manual for details on this, and the Rcpp
documentation (maybe starting with Rcpp-introduction.pdf) for more on Rcpp.

Rcpp-specific questions should go to the rcpp-devel mailing list.

Regards, Dirk

| that the only way i could do it working is to declare the function as void
| function (double x, double y, double result) and pass the result with RCPP
| Can you please tell me if this is the only way out?
| And if this is the case how I can implement a function with is recurence
| property eg a Factorial funtion
| int factorial (int a){ a=factorial(a-1);}
| 
| tnks in advance for your help
| 
| --
| View this message in context: http://r.789695.n4.nabble.com/Export-a-function-from-RCPP-in-R-of-type-double-tp3567793p3567793.html
| Sent from the R help mailing list archive at Nabble.com.
| 
| ______________________________________________
| R-help at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-help
| PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
| and provide commented, minimal, self-contained, reproducible code.

-- 
Gauss once played himself in a zero-sum game and won $50.
                      -- #11 at http://www.gaussfacts.com



More information about the R-help mailing list