[R-sig-Fedora] Problem running R from within a script

Martyn Plummer martyn.plummer at r-project.org
Wed Nov 26 11:41:54 CET 2008


On Tue, 2008-11-25 at 14:12 -0500, Joshua Kramer wrote:
> Thanks for the help Tom!
> 
> >> /usr/bin/R CMD BATCH --no-restore --no-save '--args $taxFile $taxFile.taxonomy' batchMakeTax.R batchMakeTax.log
> >
> > I'm just guessing here, but those ' ' single quotes don't seem to make
> > sense. Try dropping them (or moving them to just be around '$taxFile
> > $taxFile.taxonomy').
> 
> The problem is this.  When I drop the quotes alltogether, R considers the 
> $taxFile to be the R input file, not a parameter.  When I put quotes 
> around the '$taxFile $taxFile.taxonomy', it picks them up correctly but 
> takes them literally, IE expects the $taxFile to have a quote as the first 
> character of its filename.
> 
> Thanks,
> -Josh

This looks like a shell problem rather than an R problem. On the command
line, your invocation of R works correctly.  Try changing your script to
invoke R directly, instead of defining and then expanding the shell
variable "makeCommand":

for taxFile in $FILES
do
	echo "Processing $taxFile"
	/usr/bin/R CMD BATCH --no-restore --no-save "--args $taxFile $taxFile.taxonomy" batchMakeTax.R batchMakeTax.log
done

Martyn
-- 
Martyn Plummer <martyn.plummer at r-project.org>

-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}



More information about the R-SIG-Fedora mailing list