mercredi 15 février 2017

Make execution stop on error in RStudio

When executing a block of code in RStudio, execution doesn't actually stop when an error occurs. For example, if I have the following code in the open editor:

x <- 'test'
stopifnot(is.numeric(x))
print('hello world')

And run it (either with command-return or by clicking the "Run" button), it prints the error but then marches on and executes the print statement.

Is there a way to configure RStudio to not proceed past the error? i.e. make it stop at line 2 above and not proceed to the print statement?

Aucun commentaire:

Enregistrer un commentaire