2
n = c(1, 3, NA) 
s = c("aa", "bb", "cc") 
b = c(TRUE, FALSE, TRUE) 
df = data.frame(n, s, b)
k = df$n >= 2
df2 <- df[k,]

I want to find n is larger than 2. so I made k. If I run it:

.   n    s     b
2   3   bb   FALSE
NA NA   NA     NA

The result is above:
In this situation, I want to see a result without NA: what should I do?

markus
  • 25,843
  • 5
  • 39
  • 58
Shawn
  • 29
  • 1

0 Answers0