is there any way i can use R as a tool for scripts in unix, as wotan[hrue]$ cat example.R #!/usr/bin/R x=1 havard -- 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
On 02/05/03 14:30, Havard Rue wrote:> >is there any way i can use R as a tool for scripts in unix, as > >wotan[hrue]$ cat example.R >#!/usr/bin/R >x=1 > >havardWhat I do - explained in the R man page - is R < example.R > example.out and I have found it useful (for some reason I can't recall) to use the --vanilla option in these cases: R --vanilla < example.R > example.out And the last part (> example.out) is not needed if the script itself contains commands for writing output. I'm sure there is at least one other way to do it. -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron R page: http://finzi.psych.upenn.edu/
The feature will hopefully be available in 1.7.0. I have done some work on this thanks to some code provided by Neil McKay. It is become slightly more complex as we try to also explore different startup techniques, and get it tested on all of the different platforms. But, hopefully by 1.7.0. Havard Rue wrote:> > is there any way i can use R as a tool for scripts in unix, as > > wotan[hrue]$ cat example.R > #!/usr/bin/R > x=1 > > havard > > -- > 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 > http://www.stat.math.ethz.ch/mailman/listinfo/r-help-- _______________________________________________________________ Duncan Temple Lang duncan at research.bell-labs.com Bell Labs, Lucent Technologies office: (908)582-3217 700 Mountain Avenue, Room 2C-259 fax: (908)582-3340 Murray Hill, NJ 07974-2070 http://cm.bell-labs.com/stat/duncan
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!). -Don 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 >#!/usr/bin/R >x=1 > >havard > >-- > 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 >http://www.stat.math.ethz.ch/mailman/listinfo/r-help-- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA --------------------------------------