Silence note about too many imports through IDE devtools::check()

I'm developing a private/internal package that necessarily imports many other packages across tidyverse and Bioconductor. This package will never be publicly released so I have no concerns about the number of imports. I keep getting the note:

❯ checking package dependencies ... NOTE
  Imports includes 21 non-default packages.
  Importing from so many packages makes the package vulnerable to any of
  them becoming unavailable.  Move as many as possible to Suggests and
  use conditionally.

I am following the guidance at R Manuals :: R Internals - 8  Tools and R Internals and have these entries in my tools/check.env file:


The first suppresses the note about having installed data >5mb, and the second should suppress NOTEs about too many imports (sets the threshold to 30 instead of 20). However, this doesn't seem to work. I still get the note about too many imports (although the first seems to work -- I do not get the note about the package being too large when I include this line).

I've tried going into project options and adding additional arguments to the check command, but this only adds things to the args= option to devtools::check(). I've also tried adding these lines to ~/.R/check.Renviron but this doesn't help either.

> library(devtools)
Loading required package: usethis
> sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.3

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] devtools_2.4.5 usethis_2.2.3 

loaded via a namespace (and not attached):
 [1] vctrs_0.6.5       cli_3.6.2         rlang_1.1.3       stringi_1.8.3     purrr_1.0.2       pkgload_1.3.4    
 [7] promises_1.2.1    shiny_1.8.0       xtable_1.8-4      glue_1.7.0        htmltools_0.5.7   httpuv_1.6.14    
[13] pkgbuild_1.4.3    ellipsis_0.3.2    fastmap_1.1.1     lifecycle_1.0.4   memoise_2.0.1     stringr_1.5.1    
[19] compiler_4.3.3    miniUI_0.1.1.1    sessioninfo_1.2.2 fs_1.6.3          htmlwidgets_1.6.4 Rcpp_1.0.12      
[25] urlchecker_1.0.1  rstudioapi_0.15.0 later_1.3.2       digest_0.6.34     R6_2.5.1          magrittr_2.0.3   
[31] tools_4.3.3       mime_0.12         profvis_0.3.8     remotes_2.4.2.1   cachem_1.0.8     

1 Like

That check is off by default AFAICT (r-source/src/library/tools/R/QC.R at d395ce8db0e8080a0e9b58b620b59e02b6f436d8 · wch/r-source · GitHub), so maybe you override that env var somewhere in another config file?

I was able to reproduce this NOTE. I created a dummy package, added 30 dependencies to Imports with paste(rownames(installed.packages())[1:30], collapse = ","), and then ran devtools::check():

N  checking package dependencies (4.7s)
   Imports includes 30 non-default packages.
   Importing from so many packages makes the package vulnerable to any of
   them becoming unavailable.  Move as many as possible to Suggests and
   use conditionally.

Setting _R_CHECK_PKG_SIZES_THRESHOLD_=40 in tools/check.env has no effect on devtools::check() because that file is only used by {rcmdcheck}

I agree. This NOTE seems specific to devtools::check(). When I run R CMD check in the terminal, or rcmdcheck::rcmdcheck() in the R console (even without tools/check.env), I do not get this NOTE.

1 Like

Oh wait. Duh. devtools::check() calls rcmdcheck::rcmdcheck(). Well that at least narrows it down. Somehow devtools::check() is modifying the env vars prior to calling rcmdcheck(), and using tools/check.env is not sufficient to override this

Thanks for looking into this so quickly. I'll also NOTE that when I uncheck the "Use devtools pkg functions if available" from the project options I still get this note.

That's a difference in behavior for me. When I uncheck that option and check in RStudio (Ctrl+Shift+E), the NOTE disappears. I'm testing this with RStudio Desktop 2023.12.1+402 on Windows 11.