How to disable “Save workspace image?” prompt in R?

前端 未结 11 1813
迷失自我
迷失自我 2020-11-29 23:51

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

相关标签:
11条回答
  • 2020-11-30 00:13

    How about just avoiding the prompt by typing q('no') instead

    0 讨论(0)
  • 2020-11-30 00:16

    If you are using Rgui, right-click on the icon you use to start R and click on "Properties", and add --no-save to the command that starts R.

    (from http://tolstoy.newcastle.edu.au/R/help/05/03/1115.html)

    If you are using a different editor than Rgui, you have to pass --no-save to the R command line when starting R

    0 讨论(0)
  • 2020-11-30 00:17

    You can create an alias for the R command:

    using bash: alias R='R --no-save'

    using csh: alias R 'R --no-save'

    0 讨论(0)
  • 2020-11-30 00:21

    Overwrite default option for save argument of quit function

    formals(quit)$save <- formals(q)$save <- "no"
    

    put this line in .Rprofile

    Edit: added q, so there is no prompt no matter which variant is used

    0 讨论(0)
  • 2020-11-30 00:22

    If you feel adventurous enough, you could also edit the startup section at the end of /usr/bin/R, i.e. add --no-save to the exec calls. However, if you need to save your workspace, remember to save.image().

    0 讨论(0)
提交回复
热议问题