Closed
Description
lintr::lint("1:10\n", lintr::implicit_integer_linter())
# <text>:1:2: style: Integers should not be implicit. Use the form 1L for integers or 1.0 for doubles.
# 1:10
# ~^
# <text>:1:5: style: Integers should not be implicit. Use the form 1L for integers or 1.0 for doubles.
# 1:10
# ~~^
but typeof(1:10)
is "integer"
, and the performance is essentially identical:
microbenchmark::microbenchmark(
1L:10L,
1L:10,
1:10L,
1:10,
times = 1e6
)
# Unit: nanoseconds
# expr min lq mean median uq max neval
# 1L:10L 199 242 479.8983 257 284 89303201 1e+06
# 1L:10 197 237 376.0418 251 278 10444161 1e+06
# 1:10L 198 239 354.6013 252 280 10678523 1e+06
# 1:10 190 233 405.9966 246 274 14666175 1e+06