[R-pkg-devel] Vignettes & _R_CHECK_DEPENDS_ONLY_=true

Arne Henningsen @rne@henn|ng@en @end|ng |rom gm@||@com
Mon Jun 20 11:16:52 CEST 2022


Thanks a lot, Henrik and Duncan! Your responses are really helpful :-)
 I have revised the 'systemfit' package based on your suggestions and
uploaded a new version to CRAN.

/Arne

On Fri, 10 Jun 2022 at 01:05, Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
>
> On 09/06/2022 12:23 p.m., Henrik Bengtsson wrote:
> > On Thu, Jun 9, 2022 at 8:53 AM Arne Henningsen
> > <arne.henningsen using gmail.com> wrote:
> >>
> >> Dear all
> >>
> >> My R package "systemfit" has a 'vignette' that uses the R packages
> >> "plm" and "sem", while the actual code of the "systemfit" package does
> >> not depend on these two packages. Currently, the "systemfit" package
> >> 'Suggests' the "plm" package and the "sem" package. However, CRAN
> >> started to check packages with '_R_CHECK_DEPENDS_ONLY_=true' so that
> >> the checking of the "systemfit" package returns an error message
> >> because the vignette cannot be created without the "plm" and "sem"
> >> packages.
> >
> > Also, the case for one of your example, cf.
> > https://cran.r-project.org/web/checks/check_results_systemfit.html
> >
> >> I am considering changing the DESCRIPTION file so that the
> >> "systemfit" package will 'Depend' on the "plm" and "sem" packages
> >> (although only the vignette depends on these two packages). Is this
> >> the recommended way to do or is there a better way to make the
> >> "systemfit" package pass the tests at CRAN?
> >
> > To keep them as Suggests:ed packages, you need to run the code in your
> > examples and vignettes that rely on them conditionally on the being
> > installed, e.g.
> >
> > if (requireNamespace("plm", quietly = TRUE)) {
> >    ...
> > }
> >
> > FWIW, you're using Sweave, but if you'd used knitr, there are easy
> > ways to do this also for vignettes.  I forgot the details, but I saw a
> > simple solution the other week somewhere out there on the interwebs.
> >
> > If you don't want to do this, then yes, you need to turn those
> > dependencies into hard dependencies, e.g. Depends or Imports.
>
> In knitr, you can use the chunk option `eval = requireNamespace("plm",
> quietly = TRUE)`.  I'd put a comment in the code chunk too, saying it
> won't be evaluated if plm is not available, but this is not a
> requirement, just being nice to the reader.
>
> Duncan Murdoch



-- 
Arne Henningsen
http://www.arne-henningsen.name



More information about the R-package-devel mailing list