11.2 Do not stop on error

Sometimes you may want to show errors on purpose (e.g., in an R tutorial). By default, errors in the code chunks of an Rmd document will halt R. If you want to show the errors without stopping R, you may use the chunk option error = TRUE, e.g.,

```{r, error=TRUE}
1 + "a"

You will see the error message in the output document after you compile the Rmd document:

Error in 1 + "a": non-numeric argument to binary operator

In R Markdown, error = FALSE is the default, which means R should stop on error when running the code chunks.