[R] R as a `script'

Jonathan Baron baron at cattell.psych.upenn.edu
Wed Feb 5 14:40:04 CET 2003


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
>
>havard

What 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/




More information about the R-help mailing list