Skip to content
Prev 6277 / 12125 Next

[R-pkg-devel] Error in loadNamespace(x) : there is no package called 'formatR'

I'm quite sure you want to use the following:

Suggests: knitr, rmarkdown, formatR
VignetteBuilder: knitr

Here are the details.  For the 'VignetteBuilder' field, you want to
put all packages that provide the **vignette engines** you are using.
For example, if your package vignettes use either of

%\VignetteEngine{knitr::knitr}
%\VignetteEngine{knitr::rmarkdown}

your package is using a vignette engine from the 'knitr' package, so
you need to specify:

VignetteBuilder: knitr

Next, with 'knitr' listed in 'VignetteBuilder', you need to make sure
'knitr' is listed in either 'Depends' or 'Suggests' (or possibly
'Imports' - not sure).  If 'knitr' is only used for your vignettes, it
is sufficient to specify it under 'Suggests', which is also the most
common way to use it, i.e.

Suggests: knitr

The above settles the **vignette-engine package**.  Then your vignette
engine might depend on additional packages.  Your package needs to
depend on those too, typically also listed under 'Suggests'.  For
example, when you use %\VignetteEngine{knitr::rmarkdown}, that
vignette engine requires the 'rmarkdown' package (can be guessed from
them name but reading the docs is the only way to be sure - I think
there's work in 'tools' to improve on this).    So, this means you
need to use:

Suggests: knitr, rmarkdown

Finally, if your vignettes make use of additional, optional features
from other packages, you need to make sure your package depends on
those too.  Since you make use of 'formatR' features, you need to add
that to Suggests as well;

Suggests: knitr, rmarkdown, formatR

/Henrik

PS. Vignettes are a bit of special creatures. Their dependencies are
only needed during 'R CMD build' and 'R CMD check', which most
end-users never perform. I think it could be favorable if we could
declare vignette dependencies separate from install/run-time
dependencies, e.g.

VignetteBuilder: knitr
VignetteDepends: rmarkdown, formatR

It should make the above process a bit clearer.  It would also make it
clear to those who are only interested in viewing vignettes, but have
no interest in rebuilding vignettes, what packages they need to
install in order to access all of the package's functions.  Just an
idea.
On Fri, Nov 13, 2020 at 7:55 AM Joseph Park <JosephPark at ieee.org> wrote: