I was writing an Rmarkdown document (compile to HTML) in RStudio, and there are some code chunks that deliberately generate errors. for example:
```{r}
sum(a)
```
Since there is no previous definition for a
this chunk will naturally generate an error message like object 'a' not found
. I'd like this error message displayed in the final HTML file, but when I press Ctrl+Shift+K
in RStudio to "Knit HTML", the compiler reported the error and stopped knitting.
So how can I tell knitr
to ignore such error at compiling time and display it in the knitted HTML document?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…