Using cppFunction
, this works for example:
library(inline)
library(Rcpp)
src <- '
SEXP hellofun(){
std::vector<std::string> s;
s.push_back("hello");
s.push_back("world");
return Rcpp::wrap(s);
}'
hello_fun <- cppFunction(src)
hello_fun()
[1] "hello" "world"