[R-pkg-devel] Vignette depends on BH

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Tue Jun 2 21:53:17 CEST 2020

On 02/06/2020 3:45 p.m., Tim Keitt wrote:
> I have an RMarkdown vignette in a package that uses Rcpp and depends on BH.
> I added BH to the Suggests list. It is still generating warnings about BH.
> What is the correct way to handle this?

If a package is listed in Suggests, it should still work (possibly with 
diminished capabilities) when that package is not present.  So at the 
start of your vignette you could have something like

if (!require("BH")) {
   message("This vignette needs BH; since it is not installed, code will 
not be executed.")

   # Set default for chunk option "exec" to FALSE in all code chunks.

Duncan Murdoch

More information about the R-package-devel mailing list