简体   繁体   English

如何使用 .Rprofile 使 q('yes') 成为 R 中的默认退出行为?

[英]How to make q('yes') the default quitting behavior in R using .Rprofile?

I'd like to be able to type q() in R and have R quit rather than be prompted as to whether I want to quit.我希望能够在 R 中键入q()并让 R 退出,而不是被提示我是否想退出。

Is there some code that I could put into my .Rprofile file to make this happen?是否有一些代码可以放入我的.Rprofile文件中以实现此目的?

I'd prefer if I didn't have to have a custom function floating around in my workspace.如果我不必在我的工作区中浮动自定义函数,我会更喜欢。

In your Rprofile.site file:在您的 Rprofile.site 文件中:

q <- function(save = "yes", status = 0, runLast = TRUE){
.Internal(quit(save, status, runLast))
#<environment: namespace:base>
}

使用 R --vanilla 效果更好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM