[R] R as a `script'

Don MacQueen macq at llnl.gov
Thu Feb 6 00:46:02 CET 2003

In R 1.6.2 you can do this if you start the script with

    #! /path/to/r_home/lib/R/bin/R.bin

provided that you first define the environment variables R_HOME and 
LD_LIBRARY_PATH as they are defined in the R shell script (/usr/bin/R 
in your case).

I've only tested this running on Sun Solaris. I can't claim to have 
done extensive testing for pitfalls (i.e., pitfalls that aren't 
obvious to me!).


At 2:30 PM +0100 2/5/03, Havard Rue wrote:
>is there any way i can use R as a tool for scripts in unix, as
>wotan[hrue]$ cat example.R
>  Havard Rue
>  Department of Mathematical Sciences
>  Norwegian University of Science and Technology
>  N-7491 Trondheim, Norway
>  Voice: +47-7359-3533    URL  : http://www.math.ntnu.no/~hrue 
>  Fax  : +47-7359-3524    Email: havard.rue at math.ntnu.no
>R-help at stat.math.ethz.ch mailing list

Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

More information about the R-help mailing list