I have tried (via roxygen2) @import data.table
and importing just the functions I use (@importFrom data.table data.table rbindlist setkey setDT := .SD
. Either way I get this warning about the .
"function", which I assume is from this kind of usage:
dt[x, .(a, b, c)]
. I can't find any way to import .
without causing an error.
And as a followup question, is there a recommended way to hide the no visible binding for global variable
for a
, b
, and c
? There are quite a few other questions about this latter NOTE but I haven't seen a satisfying answer. globalVariable
and setting the column names to placeholder values elsewhere in the function are ugly hacks. Should I switch to some other method of specifying the columns which would solve both issues?
Instead of using globalVariables
you can also define those variables locally, not polluting global environment.
I will copy my comment from github issue Rdatatable/data.table#850
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.
Worth to note that issue is relevant to any NSE interface, not just data.table. NSE basically makes CRAN check unable to investigate if variables used has been defined in some NSE interface, thus raising a note.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With