Closed azoimide closed 5 years ago
This is debatable, given that lexical scope is a feature, not a bug in R:
function(lst)
{
y <- 42
lapply(lst, function(x) x + y)
}
Here, the inner function will find y in the scope of the outer function without requiring it as an explicit argument.
Agreed, lexical scoping is used a great deal in R code, I don't think we should have a linter for this.
Linting this code should yield a warning since the function uses a variable that is neither a parameter nor local: