How to remove "rows" with a value of NA?

Possible duplicate:
R - delete lines with NA in the data.frame file

How to quickly delete β€œrows” in a data frame using the NA value in one of the columns?

So,

x1 x2 [1,] 1 100 [2,] 2 NA [3,] 3 300 [4,] NA 400 [5,] 5 500 

should get:

  x1 x2 [1,] 1 100 [3,] 3 300 [5,] 5 500 
+42
r
May 26 '11 at 12:52
source share
1 answer
 dat <- data.frame(x1 = c(1,2,3, NA, 5), x2 = c(100, NA, 300, 400, 500)) na.omit(dat) x1 x2 1 1 100 3 3 300 5 5 500 
+76
May 26 '11 at 12:56
source share
β€” -



All Articles