[R] Echo to file using Rscript

Bernd Wiese wiese at gfz-potsdam.de
Thu Nov 4 20:17:52 CET 2010


I use R 2.12.0 in Windows XP.
For debugging and control I am trying to get a file with contains the 
echo when code is copied into the R Gui. This works e.g. with the command:

R CMD BATCH --no-restore  D:\path\script.r

then a file called script.Rout is generated in the same folder. It 
contains the code and the corresponding output.
This does not work using:

Rscript --no-restore D:\Ketzin\Invers\V1\read_obs.r

A partial alternative is to include to the beginning of the code

sink("log.dat",type=c("output","message"))

but the file does not contain the code, only the output. Is there a way 
to geneate anything analogue to the *.Rout file? if possible only with 
command line, without the sink() command?

Best, Bernd



More information about the R-help mailing list