[Rd] making a vignette optional

Iñaki Ucar |uc@r @end|ng |rom |edor@project@org
Tue Jun 18 19:38:58 CEST 2019

On Tue, 18 Jun 2019 at 19:03, Therneau, Terry M., Ph.D. via R-devel
<r-devel using r-project.org> wrote:
> I had added a vignette to the coxme package and all worked well locally, but it failed at
> CRAN.     The issue is that the vignette involves using coxme for pedigree data, it
> doesn't work without the kinship2 package, and I hadn't put in the necessary "if
> (require(...." logic.
> The question is, how do I make the entire vignette conditional? If the package isn't
> available, there is nothing to run.  The latex itself will fail when it can't find the
> figures  (I float them), and the parts that don't will end up as inane discussion of
> material that isn't there.

This is what I do in my packages:

If SweaveOpts accept code in the same way, you can set something like

\SweaveOpts{eval=requireNamespace("kinship2", quietly=TRUE)}


More information about the R-devel mailing list