禁用保存历史记录

时间:2012-04-11 00:07:26

标签: r session history

默认情况下是否可以在R中禁用保存命令历史/会话?我真的很讨厌那些.RData和.RHistory文件!!

4 个答案:

答案 0 :(得分:14)

只需使用--no-save启动R.见R --help

将此添加到快捷方式中(例如,在Windows中右键单击快捷方式并选择属性时,此位于“目标”下)。

enter image description here

答案 1 :(得分:7)

如果您正在使用R gui,由于Brian Ripley(see here),另一种非常好的方法是将以下行放在“R_HOME / etc / Rprofile.site”文件中:

q <- function (save = "no", status = 0, runLast = TRUE)
.Internal(quit(save, status, runLast))

注意事项:当您从命令行调用R时,这将不起作用。在这种情况下,只需使用@mdsumner answer中描述的--no-save参数。

要详细了解“Rprofile.site”和“.Rprofile”(可选的每个目录配置文件),请参阅始终有用的?Startup帮助文件。

答案 2 :(得分:4)

如果您使用的是RStudio,则只需禁用设置即可。

转到“工具”->“全局选项”->“常规”并取消勾选始终保存历史记录。 enter image description here

答案 3 :(得分:1)

更灵活(Windows),将R和RStudio添加到右键菜单中,以便可以从任何目录开始

R-Gui:将以下内容保存在rguihere.reg文件中,然后双击

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\RGui]
@="R Gui here"

[HKEY_CLASSES_ROOT\Folder\shell\RGui\command]
@="cmd.exe /c \"pushd  %L &&start rgui --no-restore --no-save\""

RStudio

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\RStudio]
@="RStudio here"

[HKEY_CLASSES_ROOT\Folder\shell\RStudio\command]
@="cmd.exe /c \"pushd %L &&start C:\\PROGRA~1\\RStudio\\bin\\rstudio.exe\""
相关问题