Reputation: 52268
Sometimes if you've got a longish script, it would be handy to be able to highlight the code you want to run (the whole script or part of it), and press something like ctrl + enter to run the code, but with a caveat that the next line only runs if all the previous lines did.
Is there a way to do this inside RStudio?
Upvotes: 0
Views: 590
Reputation: 262
Two ways:
A) 'go to Debug -> On Error and change the value from “Error Inspector” to “Break in Code”.' (Jonathan McPherson at https://support.rstudio.com/hc/en-us/articles/205612627-Debugging-with-RStudio#introduction).
B) With a notebook script. In a notebook, 'only one line at a time is sent. This allows execution to stop if a line raises an error.' (RMarkdown team at https://bookdown.org/yihui/rmarkdown/notebook.html).
Upvotes: 1