Learn R Programming

lintr (version 3.0.2)

seq_linter: Sequence linter

Description

This linter checks for 1:length(...), 1:nrow(...), 1:ncol(...), 1:NROW(...) and 1:NCOL(...) expressions in base-R, or their usage in conjunction with seq() (e.g., seq(length(...)), seq(nrow(...)), etc.).

Usage

seq_linter()

Arguments

Tags

best_practices, consistency, default, efficiency, robustness

Details

Additionally, it checks for 1:n() (from dplyr) and 1:.N (from data.table).

These often cause bugs when the right-hand side is zero. It is safer to use base::seq_len() or base::seq_along() instead.

See Also

linters for a complete list of linters available in lintr.