在 R 中恢复丢失/丢弃的会话?
如果 R 因错误而需要关闭,是否可以恢复 R 会话?在将会话/数据保存到文件之前是否存在临时目录?
我真正需要的是输入命令的历史记录。
(在 WinXP 上运行 R 版本 2.12.1)
根据下面对我的问题的回答,我仍然有以下问题:
R 保存 .Rhistory 到哪里?
尽管我无法找到此文件重新启动新的 R 会话,并且仍然可以访问先前会话中的命令。 SAVEHISTORY 上的 R 参考页没有为我解决这个问题。 R 似乎将此数据存储在我无权访问的某些临时文件/文件夹中。当我运行命令 tempdir()
时,我获得了临时目录的位置,但无论是在活动会话期间还是在会话关闭之后,都没有存储任何文件。
Is it possible to recover an R session if R needed to close due to an error? Is there a temp directory where sessions/data sits before its saved to a file?
What I'd really need is the history of input commands.
(running R version 2.12.1 on WinXP)
Based on answer to my question below, I still have the following question:
Where is R saving .Rhistory to?
I am not able to find this file, despite restarting a new R session and still having access to commands from a previous session. R reference page on SAVEHISTORY did not resolve this for me. It seems that R is storing this data in some temp file/folder that I don't have access to. When I run the command tempdir()
, I get a location of the temp directory, but not a single file is being stored there, whether during an active session, or after it closes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 R 崩溃时您正在工作的工作目录,并查找名为“.Rhistory”的文件,我不知道是否每个命令都会在那里。但我确信至少有最后 50 个。
华泰
Look at the working directory where you were working when R crashed and look for a file named ".Rhistory" I don't know if every command will be there. But I'm sure that at least the last 50 are there.
HTH