Skip to content

Should any_is_na_linter() be extended to cover sum(is.na(x)) != 0L? #1575

@IndrajeetPatil

Description

@IndrajeetPatil

It doesn't seem that uncommon of a pattern to find NAs.

library(lintr)

x <- rep(c(TRUE, NA, FALSE, FALSE), 1000)

identical(
  sum(is.na(x)) != 0L, 
  anyNA(x)
)
#> [1] TRUE

# currently doesn't lint
lint(
  text = "sum(is.na(x)) != 0L",
  linters = any_is_na_linter()
)

Created on 2022-09-30 with reprex v2.0.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions