Example
Discouraged
lapply(l, function(x) mean(x)))
Recommended
Scope
-
to limit the risk of false positive, I'm thinking to limit this to the apply() family function (+ replicate()), at least as a first step. Or do you think it wouldn't be much more difficult and riskier to do this in all contexts?
-
ideally, this should detect also both tidyverse (~ mean(.x)) and base (\(x) mean(x)) lambda functions
-
I'm thinking to limit it to cases with a single argument, i.e. exclude:
lapply(l, function(x) mean(x, na.rm = TRUE))
even though the anonymous function could be removed here as well by forwarding the ... because users might find it clearer to not forward them.
Example
Discouraged
Recommended
Scope
to limit the risk of false positive, I'm thinking to limit this to the
apply()family function (+replicate()), at least as a first step. Or do you think it wouldn't be much more difficult and riskier to do this in all contexts?ideally, this should detect also both tidyverse (
~ mean(.x)) and base (\(x) mean(x)) lambda functionsI'm thinking to limit it to cases with a single argument, i.e. exclude:
even though the anonymous function could be removed here as well by forwarding the
...because users might find it clearer to not forward them.