maintaining an input / output log in R

2019-01-25 11:05发布

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.

5条回答
老娘就宠你
2楼-- · 2019-01-25 11:37

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

查看更多
你好瞎i
3楼-- · 2019-01-25 11:38
爷的心禁止访问
4楼-- · 2019-01-25 11:40

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.

查看更多
Luminary・发光体
5楼-- · 2019-01-25 11:42

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.

查看更多
疯言疯语
6楼-- · 2019-01-25 11:55

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.

查看更多
登录 后发表回答