Re: [R-pkg-devel] Why doesn't R CMD check warn that globalVariables() is undefined/not imported?

2019-09-24 Thread Henrik Bengtsson
On Tue, Sep 24, 2019 at 11:13 AM Gábor Csárdi wrote: > > I believe that this is because if it is outside of a function, then it > runs at INSTALL time, and codetools checks the installed code, i.e. > the function objects typically, and the checks never see the > globalVariables() call. That

Re: [R-pkg-devel] Why doesn't R CMD check warn that globalVariables() is undefined/not imported?

2019-09-24 Thread Gábor Csárdi
I believe that this is because if it is outside of a function, then it runs at INSTALL time, and codetools checks the installed code, i.e. the function objects typically, and the checks never see the globalVariables() call. Gabor On Tue, Sep 24, 2019 at 7:08 PM Henrik Bengtsson wrote: > > 'R

[R-pkg-devel] Why doesn't R CMD check warn that globalVariables() is undefined/not imported?

2019-09-24 Thread Henrik Bengtsson
'R CMD check' will give a warning that 'speed' is an unknown variable in: low_speeds <- function(limit) { subset(datasets::cars, speed <= limit) } We can tell 'R CMD check' that 'speed' is a false positive by declaring it a "global" variable. This can be done, by: low_speeds <-