[Rcpp-devel] R Initialization with RInside

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


Howdy,

On 12 June 2013 at 20:51, John Buonagurio wrote:
| Hi Dirk, 
| 
| Thank you for the quick reply. I have all of the examples working and my 
| application already runs well on my build system, at this point I'm just 
| trying to figure out how to make everything redistributable. Your 
| qtdensity sample was a great help - especially the 
| QtDensity::filterFile() function to get Qt SVG graphics working. 

Ah, yes, the non-standard standardness I experienced there.  Mike Lawrence
was helpful with the hint the svg file.  I think the default just does png now.

| The fundamental issue is that I want the application binary and 
| associated R installation to be fully portable, and as such I can't 
| depend on a specific value of R_HOME. It isn't strictly necessary to 
| have the setup this way so this is not a critical issue -- theoretically 
| the program should work with R 2.11.0+ and I can just use my specific 
| package versions after R startup using .libPaths() -- but it would just 
| be nice to not rely on a user's specific R configuration nor ask to 
| install R separately. 
| 
| Your response and my quick review of RInside::initialize(...) in 
| RInside.cpp confirms that this is just not supported and I really should 

You seem to be finding your way around this with some ease already, so maybe
you cam think about this:

 -- RInside was heavily influenced by littler
 -- littler always built from source (and does not exist on Windows)
 -- we 'parse' a few system / R path values _at compile time_ and rely on them

so if you deployment systems look like the build system, you're good. If not, fail.

| be using R_HOME... Looks like I'll have to add my own check for 
| .Renviron to set R_HOME analogous to what you did in RInside 0.2.9: use 
| R's "get_R_HOME()" to query it, #ifdef WIN32 and if R_HOME is NULL. 

I don't live much on Windows.  If you can think of a patch to contribute to
make this better it would possibly help a lot of people.

| Thanks again for the great software,

Great users always make it better ;-)

Dirk

| John
| 
| -----Original Message-----
| From: Dirk Eddelbuettel [mailto:edd at debian.org] 
| Sent: Wednesday, June 12, 2013 3:40 PM
| To: John Buonagurio
| Cc: rcpp-devel at lists.r-forge.r-project.org
| Subject: Re: [Rcpp-devel] R Initialization with RInside
| 
| 
| 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-deve
| | l
| 
| --
| Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

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


More information about the Rcpp-devel mailing list