This maybe a bit converse to similar questions. I would like R to abort\warn if anywhere in the code, a function uses a variable in a parent environment. Is there some base option to achieve that? I would like a solution that is general for a session, not a particular check. Thank you.
There is a function findGlobals
in the codetools
package. Maybe this is helpful:
library(codetools)
x <- "global"
foo <- function() x
foo()
[1] "global"
findGlobals(foo)
[1] "x"
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