Janko Thyson
2010-Feb-11 15:25 UTC
[R] Using "Rscript" in combination with "eval()" results in error
Dear List,
I'm having trouble running a .bat file which calls an R-Script via the
command line (using "Rscript").
I put the following line in a file called "test.bat":
Rscript --vanilla test.R
Then I tried to launch "test.bat" via Windows' CMD (I plan to make
this a
scheduled Windows task).
The actual R-script ("test.R") is executed just fine until it gets to
a line
containing an eval() expression:
eval(parse(file="C:/temp/another.script.R"))
and R (or Windows' CMD, respectively) throws the following error
Error in if (file == "") <- stdin() else { : Argument is of length
0
Calls: source -> eval.with.vis -> eval.wtih.vis -> source
Execution stopped
Usually such "eval()" expressions work just fine in my scripts.
I tried the following already:
1) to.load.file <- file("C:/temp/another.script.R",
open="rt");
eval(parse(file=to.load.file): No luck
2) Running "test.R" within a Rterm session: Works fine.
3) Calling the following from within a Rterm session:
system("Rscript C:/temp/test.R", wait=TRUE, invisible=FALSE)
That works too!
Is there something one needs to be aware of regarding "eval()" or
"source()"
when launching a script via a CMD call to a .bat file?
Im running Windows XP and R-2.10.1
Any hints greatly appreciated!
Thanks,
Janko
Seemingly Similar Threads
- temp Rscript file collision on Windows
- Significant memory leak when using XML on Windows
- Problems building own package (Error: "package has been build before R-2.10.0")
- Problems building own package (Error: "package has been build before R-2.10.0")
- Flattening lists and environments (was: "how to flatten a list to the same level?")
