如何禁用“保存工作区图像?"在 R 中提示? [英] How to disable "Save workspace image?" prompt in R?

查看:45
本文介绍了如何禁用“保存工作区图像?"在 R 中提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我退出交互式 R shell 时,它每次都显示一个烦人的提示:

<前>>>保存工作区图像?[y/n/c]:n

我总是回答不",因为如果我想保存我的工作,我会在尝试退出之前这样做.

如何摆脱提示?

<小时>

注意:见?save.image

解决方案

您可以通过 --no-save 启动 R 时的命令行参数,或者您可以覆盖 q 函数:

utils::assignInNamespace("q",功能(保存=否",状态= 0,运行最后= TRUE){.内部(退出(保存,状态,运行最后))},根据")

将上面的代码放在您的 .Rprofile 中,这样它就会在每个会话的启动时运行.

When I exit the interactive R shell, it displays an annoying prompt every time:

>
>
Save workspace image? [y/n/c]: n

I'm always answering "no" to it, because if I wished to save my work, I'd do that before trying to exit.

How to get rid of the prompt?


Note: see ?save.image

解决方案

You can pass the --no-save command line argument when you start R, or you can override the q function:

utils::assignInNamespace(
  "q", 
  function(save = "no", status = 0, runLast = TRUE) 
  {
    .Internal(quit(save, status, runLast))
  }, 
  "base"
)

Put the above code in your .Rprofile so it will be run on startup for every session.

这篇关于如何禁用“保存工作区图像?"在 R 中提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆