Skip to content
Back to formatted view

Raw Message

Message-ID: <23120.63506.733467.972425@bud.eddelbuettel.com>
Date: 2018-01-06T16:23:46Z
From: Dirk Eddelbuettel
Subject: [R-pkg-devel] Imports: vs Suggests:
In-Reply-To: <CAJmOi+OfU8sMZLAyA59Hreg5Tdws+zSp_Asy9=Gz-VxmrdxP8A@mail.gmail.com>

Hugh,

You may be looking at this from the wrong angle. "Imports" is really an
updated variant of "Depends".  Both of them declaure _unconditional_ use of
another package.  (How they are used is the fine distinction between loading
and attaching which we'll skip here). The key point is that a package named
by either of these _must_ be present.

"Suggests" is different as it declares _optional_ use for which you should
then test.  To take a simple example, Rcpp offers Rcpp.package.skeleton() by
extending / wrapping around package.skeleton().  If and when the _optional_
package pkgKitten (which is a Suggests: of Rcpp) is present, we use it:


    havePkgKitten <- requireNamespace("pkgKitten", quietly=TRUE)

    # ... stuff omitted

    ## update the package description help page
    if (havePkgKitten) {                # if pkgKitten is available, use it
        pkgKitten::playWithPerPackageHelpPage(name, path, maintainer, email)
    } else {
        ### other fallback code ....
    }

See https://github.com/RcppCore/Rcpp/blob/master/R/Rcpp.package.skeleton.R

Hth,  Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org