[Rd] R as shell script
Juha Vierinen
jvierine at gmail.com
Fri Jul 14 16:15:01 CEST 2006
Hi,
I am considering if I should invest in learning R. Based on the
language definition and introductory documents, it seems nice. But now
I am faced with a problem: I want to be able to run R programs easily
from the unix shell, and write scripts that can automatically select R
as the interpreter:
#!/usr/bin/R
cat("Hello world.\n")
This of course doesn't work, because /usr/bin/R is a shell script.
I have been able to create a binary wrapper that calls R with the
correct arguments, which is documented here:
http://kavaro.fi/mediawiki/index.php/Using_R_from_the_shell
This still lacks eg. standard input (but I have no idea how I can
implement it in R) and full command line argument passing (can be
done), but am I on the right track, or is there already something that
does what I need?
juha
More information about the R-devel
mailing list