Jim Hester's "lintr" package contains many different linters for R. The README for the package describes one of the linters in this way:
undesirable_function_linter:
report the use of undesirable functions, e.g. options or sapply and suggest an alternative.
I was surprised. I've been using R for many years, and I've been using options()
and sapply()
for many years. What makes them undesirable? And are there better alternatives?
I know about getOption()
, but it's not a substitute for options()
. I also know about the *apply()
variants, Map()
, and the Tidyverse map
functions. The Tidyverse functions do seem better to me on the whole than sapply()
or Map()
-- I prefer the defaults and the ordering of arguments in the Tidyverse functions -- but I wouldn't have thought to call sapply()
"undesirable."