Invoking R in Linux
I'm porting an application written in R that currently runs under Windows over to Linux (Fedora 12) and am having some problems. Currently, under Windows I invoke R to run as a batch process as:
Rterm.exe --no-save --no-restore --quiet < myRprog.r > myRprog.log 2>&1
This little batch gem executes the program myRprog.r and outputs the processed statements and errors/warnings to myRprog.log and the the executed results into myRprog.lst.
I would like to recreate the same behavior under Linux. I've tried many different variations of the following without success.
开发者_JAVA百科R CMD BATCH myRprog.r myRprog.lst myRprog.log
Is there a way to emulate the behavior of writing two files out (log and listing) under Linux using batch?
Thanks.
Phil Rack
Try
R --no-save --no-restore --quiet < myRprog.r > myRprog.log 2>&1
there are dozens of other methods (which probably will soon appear), but this is most similar to your Windows use.
Or, as you're on Linux, use r
from littler.
log and lst seem to be very SASish concepts.
R CMD BATCH myRprog.r myProg.rout
will run your program and redirect all output to myProg.rout. However, you are free to modify myProg.r so that datasets and the like are written into different files that you can then capture (possibly from an external application).
精彩评论