3

I received the following error when running R CMD check:

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

I've found a previous question and follow the answer there by making sure that the packages are included in the Imports field of my DESCRIPTION file, but I still received the error.

Here is my DESCRIPTION file

Type: Package Title: mytitle Version: 0.0.0.9000 Authors@R: c( person("John", "Doe", email = "[email protected]", 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 

And here is my NAMESPACE file created by Roxygen:

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) 

Can you please tell me what I missed?

3
  • What are you trying to do with them? It sounds a bit like you are really wanting to use Suggests: link Commented Nov 12, 2018 at 0:04
  • I need to use Imports rather than Suggests because I'm using ggplot(), %>% and foreach() in my package code. Commented Nov 12, 2018 at 1:28
  • For some reason, when I removed Depends: R (>= 3.1) then it works. Any idea why? Commented Nov 12, 2018 at 22:07

1 Answer 1

3

When R CMD check runs, it built a binary package .zip file on the parent folder of the package's folder, and also a folder call pkgname.check. I think the next time R CMD check runs, it may not rebuild that folder or that file, depending on whether changes have been made in the package. I deleted those file and folder and rebuild, everything works.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.