Closed HenrikBengtsson closed 9 months ago
I fixed some and removed some. The remaining are legitimate data.table syntax. Do we really need to use dummy assignments every time we use data.table in order to please R CMD check?
* checking R code for possible problems ... [24s/24s] NOTE
dplot3_box: no visible binding for global variable ‘ID’
dplot3_box: no visible binding for global variable ‘timeperiod’
dt_describe: no visible binding for global variable ‘..index_nm’
dt_describe: no visible binding for global variable ‘..index_cf’
dt_describe: no visible binding for global variable ‘..index_dt’
dt_get_duplicates: no visible binding for global variable ‘..on’
dt_get_factor_levels: no visible binding for global variable
‘..factor_index’
glm2table: no visible binding for global variable ‘..i’
matchCasesByRules: no visible binding for global variable ‘ID’
mplot3_laterality: no visible binding for global variable ‘..index’
preprocess_: no visible binding for global variable ‘..exclude’
s_LightRuleFit: no visible binding for global variable ‘Empirical_Risk’
s_LightRuleFit: no visible binding for global variable ‘Coefficient’
Undefined global functions or variables:
..exclude ..factor_index ..i ..index ..index_cf ..index_dt ..index_nm
..on Coefficient Empirical_Risk ID timeperiod
I set everything to NULL
as suggested and the NOTE is gone.
Do we really need to use dummy assignments every time we use data.table in order to please R CMD check?
I do this (set dummy variables to NULL inside functions for NSE variables), because then when R CMD check --as-cran
complains in the future, I know it's most likely a true positive. If I'd used utils::globalVariables()
, there's a risk that there will be false negatives, especially if your code base is huge.
I write "To please R CMD check", but I'm really grateful for these checks, because they definitely have spotted bugs in code, both in my code and others.
It's awesome that the package now passes the static-code inspection/validation.
R CMD check --as-cran
reports:Some of them might be bugs, i.e. non-existing functions or objects. Others might be used in NSE code. For the latter, I use dummy assignments to NULL at the top of the function, e.g.
Others use:
but I think that's too blunt and error-prone.