[Rcpp-devel] R Initialization with RInside

Dirk Eddelbuettel edd at debian.org
Wed Jun 12 21:39:45 CEST 2013


John,

[ Reindenting this to 80cols ]

Welcome, and thanks for posting here.

On 12 June 2013 at 19:13, John Buonagurio wrote:
| 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

RInside cannot work without R installed.  End of story.

| environment variables such as R_HOME in order to run the application. I am

RInside (particularly on Windows which is an OS without an established
tradition of where things get installed) will probably not work without R
(see above) and knowledge of R_HOME (which is "read-only")

| 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)." 

That is from R, and RInside needs to find R. See above.

| 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? 

Setting R_HOME helps.

| 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. 

I strongly recommend you get the Qt-based example working first, and then
expand from here.

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

Sure. Which is why we add a minimal working example to the package.

Hth,  Dirk

 
| Thanks,
| John
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list