I'm developing an R package and have a custom function which contains a if(condition) stop("Error message")
conditional. I call this function in a package vignette with the intention of generating the error message and including that in the vignette. However, this is causing vignette building to fail.
How can I force vignette building to proceed even when the code generates error messages, and retain those error messages in the vignette document?
The knitr chunk options documentation says:
rmarkdown
'srender()
function resets this to beFALSE
by default (unlikeknitr
itself), arguably a better default. You can override this and set it back toTRUE
by (I think) eithererror=TRUE
in the options for a particular chunk, orknitr::opts_chunk$set(error=TRUE)
in an early code chunk to set the option globally.I would suggest the former (i.e., only allow errors where you are expecting them ...)