How to remove "rows" with a NA value? [duplicate]

Possible Duplicate:
R - remove rows with NAs in data.frame

How can I quickly remove "rows" in a dataframe with a 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 result in:

     x1  x2
[1,]  1 100
[3,]  3 300
[5,]  5 500

Solution 1:

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