From jvierine at gmail.com  Fri Jul 14 16:15:01 2006
From: jvierine at gmail.com (Juha Vierinen)
Date: Fri, 14 Jul 2006 17:15:01 +0300
Subject: [Rd] R as shell script
Message-ID: <b96098070607140715hc7ca785xa5ca190348f24aa3@mail.gmail.com>

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



[Rd] R as shell script
Juha Vierinen