thmsfuller066 at gmail.com
2010-Aug-19 21:30 UTC
[R] How to execute an expression as well as a .R file with Rscript?
Hello All, I'm trying to supply both an expression and a .R file to Rscript. But it seems that it is not possible with the first approach (see below) and I'll have to use the second approach (see below). I'm wondering if it is a bug in Rscript not to support both a .R file and an expression. $ cat main.R x=x+3 print(x) $ cat main.sh #!/usr/bin/env bash Rscript -e 'x=10' main.R #first approach Rscript -e "x=10; source('main.R')" #second approach $ ./main.sh> x=10 > > > x=10; source('main.R')[1] 13> >-- Tom