New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R CMD check NOTE: No visible binding for global variable #850
Comments
Can't necessarily be ignored; some packages are being rejected, and authors being told by CRAN to use |
Hi, I like the idea of
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. |
* resolve mismatch in documentation (asfactor != as_factor) * add reshape2 to the Depends field for the ipu_step example * Avoid 'no visible binding for global variable ...' by initializing to NULL V1 <- baseweight <- NULL The last error occures since the check does not deal properly with non-standard evaluation (NSE). See here: Rdatatable/data.table#850
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.The text was updated successfully, but these errors were encountered: