Closed
Description
Btw, shouldn't the message here be different:
library(lintr)
lint(
text = "1:nrow(data.frame())",
linters = seq_linter()
)
#> <text>:1:1: warning: [seq_linter] 1:nrow(...) is likely to be wrong in the empty edge case. Use seq_len() instead.
#> 1:nrow(data.frame())
#> ^~~~~~~~~~~~~~~~~~~~
Created on 2022-07-25 by the reprex package (v2.0.1)
Current:
1:nrow(...) is likely to be wrong in the empty edge case. Use seq_len() instead.
Expected:
1:nrow(...) is likely to be wrong in the empty edge case. Use seq_len(nrow(...)) instead.
Since that's the correct replacement:
1:nrow(data.frame())
#> [1] 1 0
seq_len(nrow(data.frame()))
#> integer(0)
Originally posted by @IndrajeetPatil in #1468 (comment)
Metadata
Metadata
Assignees
Labels
No labels