Hello to everyone
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
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.
Dirk Eddelbuettel
2011-Jun-02 15:30 UTC
[R] Export a function from RCPP in R of type double
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
thnks for the reply regards christos -- View this message in context: http://r.789695.n4.nabble.com/Export-a-function-from-RCPP-in-R-of-type-double-tp3567793p3570165.html Sent from the R help mailing list archive at Nabble.com.
Maybe Matching Threads
- Bloomberg API functions BAddPeriods Binterpol Bcountperiods in RBloomberg
- Rcpp too good to be true?
- inline/Rcpp: Problem with space in path under Windows
- Bridging Issues with Xen
- invalid operands of types ‘SEXPREC*’ and ‘R_len_t’ to binary ‘operator/’ with Rcpp.