Packages using data.table (and I believe dplyr as well) get this NOTE (perhaps many) from R CMD check. Is there anything we can do? It is only a NOTE so can be ignored, but even so.
Perhaps provide a function that detects those symbols and creates the globalVariables()
call automatically for the package author.
http://stackoverflow.com/questions/15409806/r-package-compilation-with-dependency-on-data-table
http://stackoverflow.com/questions/8096313/no-visible-binding-for-global-variable-note-in-r-cmd-check
IIUC, it would need a change to 'R CMD check' to make it aware of "non-standard-evaluation" that both data.table and dplyr use. That is a hard problem (perhaps even impossible without running the code). So functions ?globalVariables
was added to R in 2.15.1 and lesser known perhaps is that ?dontCheck
was added in R 3.1.0 which can be used to wrap queries using NSE. These are better than <-NULL
which has the risk of silencing true errors (or perhaps creating new ones) in other areas of the code, as well as the ones using NSE.
Can't necessarily be ignored; some packages are being rejected, and authors being told by CRAN to use globalVariables
to suppress the NOTEs. E.g.:
Hi,
it is an old issue but not closed. I was wondering if there is now a new solution ?
Otherwise, what is the good practice to follow ? still globalVariables
?
I like the idea of
a function that detects those symbols and creates the
globalVariables()
Thank you.
@cderv you can just assign NULL to the variable before using it (not confuse with override it). So you are not defining global variables, but just defining them locally in a function where you are using them. I don't think we need to address that in any special way. Closing for now as the issue is waiting for 2 years without action points defined, and isn't really a data.table issue.
Most helpful comment
@cderv you can just assign NULL to the variable before using it (not confuse with override it). So you are not defining global variables, but just defining them locally in a function where you are using them. I don't think we need to address that in any special way. Closing for now as the issue is waiting for 2 years without action points defined, and isn't really a data.table issue.