Discussion:
[Rcpp-devel] Applying R functions in a cpp method
Sergio Bra
2018-04-02 09:03:43 UTC
Permalink
Hi everybody,

I want to define a cpp function which has as input an R function, which is
applied to some internal data of my cpp code (st similar to the map
function of the purrr package). An example could be:

my_rcpp_function("mean")

Internally, I'd have a cpp function which applies that R function to some
private data (not visible from the R-side).

My question is if Rcpp provides a way to execute an R function from cpp
code or if my issue is out of the scope of Rcpp and I'd limit to return the
data and apply the R function on the R-side.

Thanks in advance.
Iñaki Úcar
2018-04-02 09:10:59 UTC
Permalink
Post by Sergio Bra
Hi everybody,
I want to define a cpp function which has as input an R function, which is
applied to some internal data of my cpp code (st similar to the map function
my_rcpp_function("mean")
Internally, I'd have a cpp function which applies that R function to some
private data (not visible from the R-side).
My question is if Rcpp provides a way to execute an R function from cpp code
or if my issue is out of the scope of Rcpp and I'd limit to return the data
and apply the R function on the R-side.
See, e.g., http://gallery.rcpp.org/articles/r-function-from-c++/

Iñaki
Post by Sergio Bra
Thanks in advance.
Sergio Bra
2018-04-02 09:18:24 UTC
Permalink
Thank you very much!! I didn't find that part reviewing the documentation
Post by Sergio Bra
Post by Sergio Bra
Hi everybody,
I want to define a cpp function which has as input an R function, which
is
Post by Sergio Bra
applied to some internal data of my cpp code (st similar to the map
function
Post by Sergio Bra
my_rcpp_function("mean")
Internally, I'd have a cpp function which applies that R function to some
private data (not visible from the R-side).
My question is if Rcpp provides a way to execute an R function from cpp
code
Post by Sergio Bra
or if my issue is out of the scope of Rcpp and I'd limit to return the
data
Post by Sergio Bra
and apply the R function on the R-side.
See, e.g., http://gallery.rcpp.org/articles/r-function-from-c++/
Iñaki
Post by Sergio Bra
Thanks in advance.
Loading...