[R] Running source from Unix line
Oleg Sklyar
osklyar at ebi.ac.uk
Thu Feb 8 22:53:33 CET 2007
See the previous reply, but also if you want to run a shell script and
need to pass arguments like file names or dir names or anything else,
you cane you the following (${1} -- 1st argument to the shell script,
${2} -- second etc):
#!/bin/sh
echo 'a="${1}";b="${2}"; source("codeWith_a_and_b.R")" | R --vanilla --quiet
The from shell (e.g. to process smth in this dir, a, with b=2):
./thisScript `pwd` 2
Oleg
--
Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466
Amir Herman wrote:
> How can I run something like source("filename") from the Unix command line?
> Maybe somthing like ./R CMD source("filename") - this does not work.
>
> I need to run an R source code file with a command from the Unix command
> line.
> assuming that I have R installed on my system.
>
> Thank you all
> Amir.
>
More information about the R-help
mailing list