[R] Command processing of arguments
Al Piszcz
apiszcz at solarrain.com
Fri Aug 15 12:42:16 CEST 2003
In the mail archives I found a solution that sets environment parameters.
http://www.r-project.org/nocvs/mail/r-help/2001/5411.html
However I would rather not create the temp files.
-----------------------------------------------------
I am using the following method...
:: File: Rba
#!/bin/sh
##
## ARG 1 is the R program to RUN
## rest of line are arguments
if [ $# -eq 0 ] ; then
echo
echo "usage: Rba RPROGRAM.r ARG1 ARG2 ...."
echo
exit
fi
program=$1
shift
cmdargs=$*
gtime R --quiet \
--no-save \
$cmdargs < $program
-----------------------------------------------------
When I acquire the variables in the R program:
userargs<-commandArgs()
# set parameters from commandline
inputfile<-userargs[4]
outputfile<-userargs[5]
I get the following error/warnings
ARGUMENT 'filename1' __ignored__
ARGUMENT 'filename2' __ignored__
Does anyone know what this means?, the parameters appear
to make into my program correctly.
-----------------------------------------------------
Ideally there would get a PERL GetOpt::Long or Shell getopt
capability/module.
More information about the R-help
mailing list