[Rd] R as shell script

From: Juha Vierinen <jvierine_at_gmail.com>
Date: Fri 14 Jul 2006 - 14:15:01 GMT


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



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Jul 15 00:17:49 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 14 Jul 2006 - 18:27:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.