Skip to content

filter not retaining rows with NA values #3196

@gtumuluri

Description

@gtumuluri

Filter is removing rows with NA values on inequality condition. While it is not hard to add to the condition to keep those rows, it does mean you almost always have to write explicit code as absence of NA can't be assured.

mydf <- data.frame(x = 1:5, y = c(letters[1:3], rep(NA, 2)))
mydf
  x    y
1 1    a
2 2    b
3 3    c
4 4 <NA>
5 5 <NA>

filter(mydf, y != 'a')
  x y
1 2 b
2 3 c

packageVersion('dplyr')
[1] ‘0.7.2’

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions