How can I call an R function that does not belong to any R package into a C++ code?. I can show you what I mean through a very semplicistic example. Suppose I have an R file where I write
myRfunction <- function(x){
return(x+2)
}
and I want to use it in a generic c++ code. So, I write something like
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
using namespace Rcpp;
using namespace arma;
using namespace std;
// [[Rcpp::export]]
arma::vec myCppfunction(arma::vec y){
arma::sec results = myRfunction(y); /* Or whatever I have to do to call it! */
return results;
}
Can someone tell me how to do it? What is the general procedure? Thank you all.