Identify cases where stringsAsFactors should be supplied explicitlySource:
Designed for code bases written for versions of R before 4.0 seeking to upgrade to R >= 4.0, where
one of the biggest pain points will surely be the flipping of the
default value of
It's not always possible to tell statically whether the change will break
existing code because R is dynamically typed -- e.g. in
x is a string, this code will be affected, but if
x is a number,
this code will be unaffected. However, in
data.frame(x = 'a'), the
output will unambiguously be affected. We can instead supply
stringsAsFactors = TRUE, which will make this code backwards-compatible.
linters for a complete list of linters available in lintr.