Search code examples
rloggingstata

How do I log an R session to a file?


Other than through redirection, which captures an entire session, is there a way to start and stop logging during an R session? To clarify, I am looking for something similar to the log using command in Stata.


Solution

  • Do you know about sink() in base R ?

    There are also some logging packages on CRAN: logging, log4r and possibly more.

    Lastly, Emacs user have ESS and its transcript mode. You can save your session as a log, and in general, the 'work from file and execute from the file' approach builds a (partial, commands-only) log as you work.