1

I would like my C++ code to call R functions, passing data between the two. The R functions are not trivial, currently defined in separate .R files.

As far as I can tell, the examples provided with Rinside have all the R code "embedded" in the C++ code.

Is the only solution to put my R code into a package, and embed a small "stub" in the C++ code which calls my package?

John
  • 451
  • 7
  • 17
  • 1
    I'm not sure I understand the question: you want to have C calling some R code (R -> C), not the opposite right (R calling C code; C -> R)? If so, can you have the R code in a header file or in a separate library? – Thomas Guillerme Feb 19 '18 at 05:54
  • Normally, you can pass an R function as argument of an Rcpp function. So, wrap that in another R function calling the Rcpp function with the other R function as argument. – F. Privé Feb 19 '18 at 08:34
  • You probably want `Rcpp::Function`, not `RInside`. – Dirk Eddelbuettel Feb 19 '18 at 13:24

0 Answers0