From edd at debian.org  Mon Nov 11 02:49:44 2013
From: edd at debian.org (Dirk Eddelbuettel)
Date: Sun, 10 Nov 2013 19:49:44 -0600
Subject: [Rd] Embedded R Fails When Run on LSF Queue System
In-Reply-To: <BAY176-W4686BF21116D18A83FEBE5E5FC0@phx.gbl>
References: <BAY176-W4686BF21116D18A83FEBE5E5FC0@phx.gbl>
Message-ID: <21120.14264.657609.673673@max.nulle.part>


On 10 November 2013 at 16:32, Nigel Delaney wrote:
| I had a quick question I was hoping someone might be able to answer, as my journey through the source code so far has not been very profitable. I have a command line program that embeds R, and the program works just fine when run from the command line. However, when I run the program as a job in the LSF cluster at my institute, the following error occurs:
| 
| Fatal error: you must specify '--save', '--no-save' or '--vanilla'
| 
| This is confusing becasue I believe I have set this by changing the startup parameters so that the no-save option is in use. I initialize R with the following collection of function calls:
| 
| 1-Rf_initialize_R
| 2-R_SetParams
| 3-setup_Rmainloop
| 
| At step 2 I pass in a structure that specifies the no-save option (as well as interactive=true, verbose=false), so I would expect it to be okay, but I still receive this error. Again, not at the terminal but only when run as a separate process.
| 
| I gathered from this thread that someone else has experienced this (https://stat.ethz.ch/pipermail/r-help/2008-March/155935.html), but am not sure how best to rectify it as I believe I have already changed the setting.
| 
| Does anyone know what a good solution or work around might be?

As a first approximation, when the manual tells you do something a certain
way, you are in fact better off doing it that way.

I stand behind two projects embedding R: littler (with Jeff Horner), and
RInside (with Romain Francois).  Both do this explicitly.  From littler.c:

	char *R_argv[] = {(char*)programName, "--gui=none", "--no-restore", "--no-save", "--no-readline", "--silent", "", ""};
	char *R_argv_opt[] = {"--vanilla", "--slave"};
	int R_argc = (sizeof(R_argv) - sizeof(R_argv_opt) ) / sizeof(R_argv[0]);

        [...]
        /* some logic to add R_argv_opt parts to R_argv omitted (/
        [...]

	Rf_initEmbeddedR(R_argc, R_argv);	/* Initialize the embedded R interpreter */

Hope this helps,  Dirk

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



[Rd] Embedded R Fails When Run on LSF Queue System
Dirk Eddelbuettel