[R] How to save & play back an entire R session?

Duncan Murdoch murdoch.duncan at gmail.com
Thu Dec 16 16:05:49 CET 2010


On 16/12/2010 9:43 AM, Roy Shimizu wrote:
> I know that at the end of an R session I'm given the option to save
> the current *state* of the session.
>
> But I would like to save the entire sequence of inputs that took place
> during the session, so that I can play them back later, and not only
> be left in the same state I was at the time of saving the session, but
> be able to see the entire history of the session (inputs and outputs).
>   (This is somewhat reminiscent of what can be done with Mathematica
> notebooks, although not exactly, since, with Mathematica notebooks,
> one doesn't necessarily save the original inputs.)
>
> Does anyone know how to achieve this?

history(Inf)

will display all inputs.  You could save those and cut and paste them to 
run again.

In the Windows console (and others?) you can save the complete 
contents.  This is just the text output.  You can re-run pieces using 
cut and "Paste commands only" (which I think is a Windows-only option).

Duncan Murdoch



More information about the R-help mailing list