How can I interrupt a running code in R with a keyboard command?

后端 未结 4 2058
广开言路
广开言路 2020-12-02 12:12

Can anyone tell how can I interrupt a running script in R?

Let\'s say I have an infinite loop or some other problem, and I want to stop the script from running. Is

4条回答
  •  伪装坚强ぢ
    2020-12-02 12:21

    Self Answer (pretty much summary of other's comments and answers):

    • In RStudio, Esc works, on windows, Mac, and ubuntu (and I would guess on other linux distributions as well).

    • If the process is ran in say ubuntu shell (and this is not R specific), for example using:

      Rscript my_file.R
      

      Ctrl + c kills the process

      Ctrl + z suspends the process

    • Within R shell, Ctrl + C kills helps you escape it

提交回复
热议问题