[R] Full Documentation of R analysis

Duncan Murdoch murdoch.duncan at gmail.com
Thu Apr 4 16:28:02 CEST 2013


On 04/04/2013 10:18 AM, will.eagle at gmx.net wrote:
>     Dear all,
>
>     I would like to fully document an analysis in R including script, output and
>     workspace data. To do this I currently run under Linux
>
>     $ R CMD BATCH myscript.R
>
>     This command combines and saves only the script commands and the output
>     ./myscript.Rout. To save the workspace, I have to explicitly specify the
>     path in the R file and apply save.image(...).
>
>     How can I save the full workspace with the same naming scheme under the same
>     path, e.g. ./myscript.RData similar to ./myscript.Rout?
>
>     Note: R CMD BATCH myscript.R --save does not work.
>

By default, R CMD BATCH runs R with --save, so it will save the image in 
the usual default place.

You can use commandArgs() in your script to find the name of the script, 
and construct a save image filename from that if you want to save 
somewhere else.

Duncan Murdoch



More information about the R-help mailing list