在小插图中使用未作为示例一部分导入的包

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

我在我正在开发的包的小插图中使用 forcatsdevtools 包中的函数。我将它们列在 NAMESPACE 文件的 Suggests(不是 Imports)字段中。

当我运行devtools::check()时,返回如下NOTE:

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

根据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的回答。

Suggests 需要添加到您的 DESCRIPTION 文件,而不是 NAMESPACE

示例来自 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", , "hadley@rstudio.com", c("aut", "cre")),
    person("Romain", "Francois", , "romain@r-enthusiasts.com", 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 <hadley@rstudio.com>
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

更新

查看您的 link 后,我发现您的文件中有错字,请将项目从 Suggets 正确移动到 Suggests

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