8

Is there an easy way to have R record all input and output from your R session to disk while you are working with R interactively?

In R.app on Mac OS X I can do a File->Save..., but it isn't much help in recovering the commands I had entered when R crashes.

I have tried using sink(...,split=T), but it doesn't seem to do exactly what I am looking for.

Paul
  • 1,325
  • 2
  • 19
  • 41

5 Answers5

6

Many of us use ESS / Emacs for this very reason. Saving old sessions with extension '.Rt' even gives you mode-specific commands for re-running parts of your session.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
4

Greg Snow wrote recently on the R-help list (a very valuable resource, SO R people!):

"You may also want to look at ?TeachingDemos::txtStart as an alternative to sink, one advantage is that the commands as well as the output can be included. With a little more work you can also include graphical output into a transcript file."

r-help

Eduardo Leoni
  • 8,991
  • 6
  • 42
  • 49
1

Check out the savehistory() command

Rob Hyndman
  • 30,301
  • 7
  • 73
  • 85
1

I'm not sure yet how to answer an answer, but there is an updated version of Ranke's vim r-plugin called r-plugin2 available here. It seems more user-friendly and robust than the original.

Abhijit
  • 625
  • 1
  • 5
  • 9
0

Emacs is good, but for those of us with a vi preference there's the vim-r plugin at:

http://www.uft.uni-bremen.de/chemie/ranke/index.php?page=vim_R_linux

It works brilliantly and has a tiny memory footprint.