Here is a minimal example:
require(Rcpp)
require(inline)
src <- '
Rcpp::Environment glob = Rcpp::Environment::global_env();
glob.assign( "foo" , "function(x) x + 1" );
'
myFun <- cxxfunction(body=src,plugin = "Rcpp")
myFun()
foo
[1] "function(x) x + 1"
Without surprise, what I get is a character variable and not a function.
You need the usual
parse/evalcombination to transform the string into an object.In
Rcpp, you can use anExpressionVector.