Namespace dependencies not required 错误,尽管我在 DESCRIPTION 中使用了 Imports

Namespace dependencies not required error although I've used Imports in DESCRIPTION

我在 运行 R CMD check 时收到以下错误:

Namespace dependencies not required: 'foreach' 'ggplot2' 'magrittr'

我找到了 a previous question 并通过确保包包含在我的 DESCRIPTION 文件的 Imports 字段中来遵循那里的答案,但我仍然收到错误。

这是我的描述文件

Type: Package
Title: mytitle
Version: 0.0.0.9000
Authors@R: c(
    person("John", "Doe", email = "johndoe@example.com", role = c("aut", "cre")),
    )
Description: More about what it does (maybe more than one line)
    Use four spaces when indenting paragraphs within the Description.
License: What license is it under?
Encoding: UTF-8
LazyData: true
Depends:
    R (>= 3.1)
Imports:
    cowplot (>= 0.9.2),
    data.table (>= 1.11.4),
    doParallel (>= 1.0.11),
    foreach (>= 1.2.0),
    GA (>= 3.1.1),
    ggplot2 (>= 2.1.0),
    hydroGOF (>= 0.3.10),
    magrittr (>= 1.4),
    parallel (>= 3.5.0),
    Rcpp (>= 0.12.16)
RoxygenNote: 6.1.0
Roxygen:
    list(markdown = TRUE)
LinkingTo: 
    Rcpp,
    RcppArmadillo    
Suggests: 
    testthat

这是我由 Roxygen 创建的 NAMESPACE 文件:

export(myfunction)
import(data.table)
import(ggplot2)
importFrom(Rcpp,evalCpp)
importFrom(cowplot,plot_grid)
importFrom(doParallel,registerDoParallel)
importFrom(foreach,"%dopar%")
importFrom(foreach,foreach)
importFrom(hydroGOF,KGE)
importFrom(hydroGOF,NSE)
importFrom(hydroGOF,rmse)
importFrom(hydroGOF,ssq)
importFrom(magrittr,"%>%")
importFrom(parallel,detectCores)
importFrom(parallel,makeCluster)
importFrom(parallel,stopCluster)
useDynLib(mytitle, .registration = TRUE)

你能告诉我我错过了什么吗?

当 R CMD 检查运行时,它在包文件夹的父文件夹中构建了一个二进制包 .zip 文件,以及一个文件夹调用 pkgname.check。我认为下次运行 R CMD 检查时,它可能不会重建该文件夹或该文件,具体取决于包中是否进行了更改。我删除了那些文件和文件夹并重建,一切正常。