问题
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