r-lib / rex

Friendly regular expressions for R.
https://rex.r-lib.org
Other
334 stars 27 forks source link

Rex DSL functions generate 'no visible global' NOTEs when used in other packages. #23

Closed jimhester closed 10 years ago

jimhester commented 10 years ago

If you use rex within another package and use any of the rex shortcuts or functions, e.g.

test <- function() rex(anything)

It generates the following NOTEs when you use R CMD check

* checking R code for possible problems ... NOTE
test: no visible binding for global variable ‘anything’

This seems to be because R CMD check does not understand the non-standard-evaluation rex uses.

I am not sure what we can do to fix this, @kevinushey any ideas? Maybe we just go back to exporting everything?

kevinushey commented 10 years ago

Yikes. :/ The only solution I could think of would use utils::globalVariables() for anything that rex understands, but this kind of an ugly solution.

jimhester commented 10 years ago

I think that is actually the correct solution, reading the documentation of the function it seems like this is exactly what it is for. Thank you for pointing it out, I had no idea utils::globalVariables() existed.

jimhester commented 10 years ago

Ok I have a good solution to this now, thank you for your help with this @kevinushey!

nr0cinu commented 3 months ago

What would the best place to put this be?

Looking at other r-lib packages, they either put it in R/AAA.R, R/zzz.R (in .onLoad), or somewhere else.