command line arguments to R

Stephen Eglen stephen at inf.ed.ac.uk
Wed Aug 4 17:04:47 CEST 2004


 > I normally get R started within ess using a bash script containing:
 >    emacs -f R
 > 
 > I'm searching for a way to add a command line argument to R, but with no 
 > luck so far.  I figure some kind of lisp wrapper function would do, but my 
 > lisp abilities are very primitive.  Any suggestions?
 > 
 > My system is linux, emacs 21.3.1, ess-5.2.2, R-1.9.1.

Hmm, I'm not sure you can do it all from the command line.  I just
tried something like:

 emacs --eval='(R "--verbose")'

but that just gets Emacs to prompt you for the actual args you want to
pass, so the `--verbose' is treated as a flag just to say that you
want to pass some args interactively.

Could you describe what args you would like to pass to R, and how
often you would like to change them?

Since you are using ESS 5.2.2, fow now you might get some mileage out
of the following approach that was introduced in 5.2.x:

Create a shell script called R-1.9.1-my which contains

----------------------------------------------------------------------
#!/bin/sh
R --my-args --that -I want to pass to R
----------------------------------------------------------------------

make this executable and put it on your path, then restart Emacs and
edit a file say foo.R

then look into the ESS -> Start Process -> Other menu and hopefully
you will see an entry "R-1.9.1-my".  If so, great; if not do
C-h v exec-path and check your script is in one of those directories.

Finally, as long as your new script is on the menu you can then do:

% emacs -f R-1.9.1-my

and you'll get the desired behavior.

Stephen




More information about the ESS-help mailing list