You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unnecessary_lambda_linter() gets confused by indexing in lambda function #2231
lintr::lint(
text="lapply(l, function(x) rle(x)$values)",
linters=lintr::unnecessary_lambda_linter()
)
#> <text>:1:11: warning: [unnecessary_lambda_linter] Pass rle directly as a symbol to lapply() instead of wrapping it in an unnecessary anonymous function. For example, prefer lapply(DF, sum) to lapply(DF, function(x) sum(x)).#> lapply(l, function(x) rle(x)$values)#> ^~~~~~~~~~~~~~~~~~~~~~~~lintr::lint(
text="lapply(l, function(x) rle(x)[['values']])",
linters=lintr::unnecessary_lambda_linter()
)
#> <text>:1:11: warning: [unnecessary_lambda_linter] Pass rle directly as a symbol to lapply() instead of wrapping it in an unnecessary anonymous function. For example, prefer lapply(DF, sum) to lapply(DF, function(x) sum(x)).#> lapply(l, function(x) rle(x)[['values']])#> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Activity
MichaelChirico commentedon Oct 6, 2023
nice find, thanks