Include errors in vignette labeled R

I am developing the R package and have a special function that contains the condition if(condition) stop("Error message") . I call this function in the vignette of the package in order to generate an error message, including the vignette. However, this causes the creation of a vignette to fail.

How can I make the vignette building continue even when the code generates error messages and stores these error messages in the vignette document?

+6
source share
1 answer

Descriptive information about the options for the cube reports:

error : (TRUE; logical) whether to save errors (from stop ()); by default, the evaluation will not stop even in case of errors! if we want R to stop on errors, we need to set this parameter to FALSE

rmarkdown render() function resets the FALSE value by default (unlike knitr itself), perhaps better by default. You can override this and return it to TRUE (I think) either

  • setting error=TRUE in the parameters for a specific fragment or
  • using knitr::opts_chunk$set(error=TRUE) in the early block of code to set options around the world.

I would suggest the first one (i.e. allow errors only where you expect them ...)

+8
source

All Articles