[Home]

Mini Reminder of R-stat tricks



To make an R script one simply puts all commands into a file and gives it a .r or .R extension.
Then you can execute the script from the command line or you can execute it once R is called. In the first case you use the following command where the additional no-save and no-restore parameters avoid the creation of a sometimes "bulky" backup R file:
bash# R CMD BATCH --no-save --no-restore scriptname.r
In the second case once you're inside R you type:
R> source("scriptname.r")

In scripts where you don't want graphic output to be sent to screen but rather to produce an image file, you can do:
R> postscript("somefilename.ps")
R> png(filename="somefilename.png", width=800, height=600)