Joshua Rosenberg
Joshua Rosenberg

Reputation: 4226

Using packages that are not imported as part of examples in a vignette

I am using functions from the forcats and devtools packages in a vignette for a package I am developing. I have them listed in the Suggests (not not Imports) field in the NAMESPACE file.

When I run devtools::check(), the following NOTE is returned:

checking for unstated dependencies in vignettes ... NOTE
'::' or ':::' imports not declared from:
  ‘devtools’ ‘forcats’

According to the answer to this question on Stack Overflow, adding these to the Suggests field ought to resolve the issue causing the note, but this doesn't seem to do so for me in this case. Can you recommend how you would address this note? If it is helpful, a link to the package is here.

Upvotes: 3

Views: 1799

Answers (1)

Kevin Arseneau
Kevin Arseneau

Reputation: 6264

The Suggests need to be added to your DESCRIPTION file, not NAMESPACE

Example from dplyr

Type: Package
Package: dplyr
Version: 0.7.4
Title: A Grammar of Data Manipulation
Description: A fast, consistent tool for working with data frame like objects,
    both in memory and out of memory.
Authors@R: c(
    person("Hadley", "Wickham", , "[email protected]", c("aut", "cre")),
    person("Romain", "Francois", , "[email protected]", role = "aut"),
    person("Lionel", "Henry", role = "aut"),
    person("Kirill", "Müller", role = "aut"),
    person("RStudio", role = c("cph", "fnd"))
    )
URL: http://dplyr.tidyverse.org, https://github.com/tidyverse/dplyr
BugReports: https://github.com/tidyverse/dplyr/issues
Encoding: UTF-8
Depends: R (>= 3.1.2)
Imports: assertthat, bindrcpp (>= 0.2), glue (>= 1.1.1), magrittr,
        methods, pkgconfig, rlang (>= 0.1.2), R6, Rcpp (>= 0.12.7),
        tibble (>= 1.3.1), utils
Suggests: bit64, covr, dbplyr, dtplyr, DBI, ggplot2, hms, knitr, Lahman
        (>= 3.0-1), mgcv, microbenchmark, nycflights13, rmarkdown,
        RMySQL, RPostgreSQL, RSQLite, testthat, withr
VignetteBuilder: knitr
LinkingTo: Rcpp (>= 0.12.0), BH (>= 1.58.0-1), bindrcpp, plogr
LazyData: yes
License: MIT + file LICENSE
RoxygenNote: 6.0.1
NeedsCompilation: yes
Packaged: 2017-09-16 15:25:52 UTC; muelleki
Author: Hadley Wickham [aut, cre],
  Romain Francois [aut],
  Lionel Henry [aut],
  Kirill Müller [aut],
  RStudio [cph, fnd]
Maintainer: Hadley Wickham <[email protected]>
Repository: CRAN
Date/Publication: 2017-09-28 20:43:29 UTC
Built: R 3.4.2; x86_64-w64-mingw32; 2017-09-29 11:50:50 UTC; windows
Archs: i386, x64

Update

After looking at your link, I see you have a typo in your file, correctly move the items from Suggets to Suggests

Suggets: forcats,
    devtools
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
Suggests: knitr,
    rmarkdown

Upvotes: 5

Related Questions