4

In the CRAN repository policy documentation, it is explicitly stated: "Packages should not modify the global environment (user’s workspace)."

When I run

R CMD check 

via

devtools::check(), 

it merely states "no visible binding for global variable x." as a NOTE rather than a WARNING.

CRAN will not accept user-contributed packages containing ERRORS and/or WARNINGS. My package has none of these. NOTES, on the other hand, are admissible.

This said, I have a few

assign(..., envir = .GlobalEnv) 

instances in a function within my R package which I intend to submit to CRAN.

Given that globals are frowned upon, the following questions arise:

(1) Why doesn't R CMD check issue WARNINGS regarding global variables?

(2) Will the CRAN maintainers complain to me regarding the use of globals in my package?

compbiostats
  • 909
  • 7
  • 22
  • After submitting a few packages to CRAN, I have found that you must have a VERY good reason if your package still has "NOTE" warnings. But seems like this should be changed to warning according to https://cran.r-project.org/web/packages/policies.html You won't get a package on CRAN if it alters the global environment... – Hector Haffenden Apr 10 '19 at 05:30
  • Don't, just don't. Maybe read this: https://stackoverflow.com/q/28246952/1412059 – Roland Apr 10 '19 at 07:46
  • @Roland Then, the most logical solution seems to be to create a new environment where required variables are accessible to the functions needing them? – compbiostats Apr 10 '19 at 14:19

0 Answers0