Message-ID: <CALEXWq1NohT+JGnLaCDb5RKFLQ5ZbWsMUO-HZDEV5+v-Ky0u=g@mail.gmail.com>
Date: 2019-06-18T17:38:58Z
From: IƱaki Ucar
Subject: making a vignette optional
In-Reply-To: <9ecfbe$btcmmv@ironport10.mayo.edu>
On Tue, 18 Jun 2019 at 19:03, Therneau, Terry M., Ph.D. via R-devel
<r-devel at 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:
https://github.com/r-simmer/simmer/blob/master/vignettes/simmer-08-philosophers.Rmd#L21
If SweaveOpts accept code in the same way, you can set something like
\SweaveOpts{eval=requireNamespace("kinship2", quietly=TRUE)}
I?aki