> testfunc(1:6)
x isEven Type
1 1 FALSE Odd
2 2 TRUE Even
3 3 FALSE Odd
4 4 TRUE Even
5 5 FALSE Odd
6 6 TRUE Even
However, if one calls devtools::check() on this, one gets the note:
checking R code for possible problems ... NOTE
testfunc: no visible binding for global variable 'isEven'
Undefined global functions or variables:
isEven
So R CMD Check is assuming that isEven in Type[isEven] = "Even" is a global variable when it is not, thus generating an incorrect note.
If a function uses the built-in R function
within()
, such as the reproducible example below:which, as expected, returns the following:
However, if one calls
devtools::check()
on this, one gets the note:So R CMD Check is assuming that
isEven
inType[isEven] = "Even"
is a global variable when it is not, thus generating an incorrect note.