[R] evaluating R expressions from C
Uwe Ligges
ligges at statistik.uni-dortmund.de
Sun Oct 12 21:58:06 CEST 2003
Iryna Lobach wrote:
>
> Hello!
>
> I've looked at R help and previous postings, but I am not sure I
> completely understand the mechanism of evaluating R expressions from C++.
C or C++ (the latter is a bit more tricky)?
Have you read the manual "Writing R Extensions"?
> They have function
>
> SEXP eval(SEXP expr, SEXP rho),
>
> but I can't get it to work.
>
> Could anyone who used it give any comments on how efficient it is and,
> if possible, give example of how to use it. My main problem is that I
> don't really understand how pass the name of R-function and it's
> parameters.
See Section 4.9, "Evaluating R expressions from C", of the manual
"Writing R Extension". There is an example just after the line you gave
above.
Re efficiency: In most circumstances it is faster than in R itself (if
not, nobody would like to do it in C!). As always, it depends on your
problem ...
Uwe Ligges
> Thank you,
> Iryna
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list