简体   繁体   中英

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.

Is there some code that I could put into my .Rprofile file to make this happen?

I'd prefer if I didn't have to have a custom function floating around in my workspace.

In your Rprofile.site file:

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

使用 R --vanilla 效果更好

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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