[R] command option for R CMD BATCH
Patrick Connolly
p_connolly at ihug.co.nz
Thu Nov 23 10:21:35 CET 2006
I wish to use R CMD BATCH to run a small R function which reads a text
file and plots a single graph to a PDF file.
> version
_
platform x86_64-unknown-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 2
minor 4.0
year 2006
month 10
day 03
svn rev 39566
language R
version.string R version 2.4.0 (2006-10-03)
>
The text files are monthly data, (called lyrical names like
October.txt or November.txt) and the end result of each run will be a
PDF file called October.pdf, etc.
It's simple enough to make a separate file for each month which has
the command to call the R function, e.g. October.r would be
plot.month("October.txt")
and use it like so:
R CMD BATCH October.r /dev/null
(the R function creates the name for the PDF file)
or slightly more elegantly, a one line shell script that takes an argument:
R CMD BATCH $1.r /dev/null
(so that the script name and the name of the month will make a PDF
file for that month)
What I'd like to do is avoid the need to make the Month.r files and
have the script pass the month information directly to the function
that a single .r file would call. If I brushed up on a bit of Perl, I
might work out how to modify the shell script to do such a thing, but
I suspect it should be simpler than that.
I had thought of using litter for such a thing, but as I looked into
it, I get the impression that's not the idea of litter. (I'm also a
bit reluctant to recompile R.)
Ideas welcome.
Thanks
--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
___ Patrick Connolly
{~._.~} Great minds discuss ideas
_( Y )_ Middle minds discuss events
(:_~*~_:) Small minds discuss people
(_)-(_) ..... Anon
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
More information about the R-help
mailing list