Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter returns incorrect values in presence of NAs #249

Closed
hadley opened this issue Feb 7, 2014 · 0 comments
Closed

Filter returns incorrect values in presence of NAs #249

hadley opened this issue Feb 7, 2014 · 0 comments
Assignees
Labels
Milestone

Comments

@hadley
Copy link
Member

@hadley hadley commented Feb 7, 2014

library(dplyr)

temp <- data.frame(
  i = 1:5,
  x = c(NA, 1L, 1L, 0L, 0L)
)
temp

filter(temp, x == 1)
temp[temp$x == 1 & !is.na(temp$x),, drop = FALSE]
  1. filter() should automatically drop any rows where the condition evaluates to NA (not sure I ever actually told you this)

  2. It should return all the rows where the condition is TRUE ;)

@hadley hadley added this to the v0.1.2 milestone Feb 17, 2014
@hadley hadley removed this from the v0.2 milestone Feb 17, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants