Skip to content

Extensions for the sum() case in boolean_arithmetic_linter #1580

@MichaelChirico

Description

@MichaelChirico

Follow-up to #1579: boolean_arithmetic_linter() can also detect some other cases of sum(<known logical vector>) == 0 --> any(<known logical vector>):

  • sum(x %in% y)
  • sum(x | y) / sum(x & y)
  • sum(!x)
  • Other common logical vector-output functions like is.na(), is.nan(), is.finite(), is.element()
  • stringr equivalent of grep() --> str_detect() recommended

Metadata

Metadata

Assignees

No one assigned

    Labels

    false-negativecode that should lint, but doesn't

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions