[Rcpp-devel] R Initialization with RInside

John Buonagurio jbuonagurio at exponent.com
Wed Jun 12 21:13:07 CEST 2013


Hi all,

I am trying to package a minimal R environment with an RInside application, without requiring R already be installed and without overwriting global environment variables such as R_HOME in order to run the application. I am currently developing under Windows though I will ultimately release other versions - hopefully this does not complicate things too much.
 
I guess I am trying to understand the startup mechanism used by RInside compared to Rgui, Rterm, R and Rcmd. Per ?Startup:

"Unless --no-environ was given on the command line, R searches for site and user files to process for setting environment variables. The name of the site file is the one pointed to by the environment variable R_ENVIRON; if this is unset, 'R_HOME/etc/Renviron.site' is used (if it exists, which it does not in a 'factory-fresh' installation). The name of the user file can be specified by the R_ENVIRON_USER environment variable; if this is unset, the files searched for are '.Renviron' in the current or in the user's home directory (in that order)."

So, I understand that I should be able to put a .Renviron file in the current executing directory of the application and set R_HOME and R_LIBS to a local, relative path. This works great for running the R interpreter, but the RInside R instance doesn't recognize it - program fails as it can't find the base package. Is there a supported way around this?

Basically the reason I need to do this: I've put together a spatial simulation tool which is hacked together using various components of Qt, QGIS and GDAL, and calls various R packages via RInside for some operations. I need to control the R version to keep everything working properly.

Very much appreciate your suggestions - hoping someone has experienced a similar problem.

Thanks,
John


More information about the Rcpp-devel mailing list