How to stop all (multiple) executed lines of code / commands in R in one go?

China☆狼群 提交于 2020-04-16 02:32:14

问题


Suppose we run multiple lines of R code, how can we stop all lines of code in on go?

Example

If the following 3 lines of code are copy/pasted into the R console in RStudio and we press enter, this will take 3 Esc or ctrl + c to stop (one press for each command). Alternatively, pressing the red Stop button in the RStudio gui also must be done three times (once per command)

Sys.sleep(10)
Sys.sleep(10)
Sys.sleep(10)

How can we stop all lines of R code from executing with one action?

What I know so far

  • For some reason, when running R from terminal, a single ctrl + c is enough to stop all lines of code
  • The only solutions I have for stopping all lines of code in RStudio are to tap Esc or ctrl + c continuously until all lines have been cancelled (inconvenient to say the least), or, to abort the R session (typically undesirable)
  • There's a similar question which differs in that it's not multiple commands over multiple lines

来源:https://stackoverflow.com/questions/61079751/how-to-stop-all-multiple-executed-lines-of-code-commands-in-r-in-one-go

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!