[R] Running source from Unix line

Roger Bivand Roger.Bivand at nhh.no
Thu Feb 8 22:41:57 CET 2007


On Thu, 8 Feb 2007, Amir Herman wrote:

> 
> How can I run something like source("filename") from the Unix command line?
> Maybe somthing like ./R CMD source("filename") - this does not work.
> 
> I need to run an R source code file with a command from the Unix command
> line.
> assuming that I have R installed on my system.

Appendix B of manual An Introduction to R:

http://cran.r-project.org/doc/manuals/R-intro.html#Invoking-R-from-the-command-line

is helpful, or see ?Startup, or google littler R script. For the time 
being, think echo 'source("filename")' | R [options], or cat filename | R

> 
> Thank you all
> Amir.
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-help mailing list