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

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 run 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

Leave a Comment