0
我想filter
所有NA
。我認爲這會工作,但它給了我一個空表,而不是我的預期:如何保留所有NA?
data_frame(var=c(sample(letters[1:2],8,replace=8),NA,NA),
value=rnorm(10,10,2)) %>%
filter(var==is.na(var))
#EXPECTED
# var value
# <chr> <dbl>
# 1 <NA> 9.119849
# 2 <NA> 13.236334
NA NA ==的討論在這裏... http://stackoverflow.com/questions/25100974/na-matches-na-but-is-not-equal-to-na-why – cory