[R] R: deleting rows

Clark Allan Allan at STATS.uct.ac.za
Thu Sep 15 10:22:38 CEST 2005


hi all

hopefully some one can help.


assume that i imported the following data into R (say the data frame is
called a)

x1	x2	x3
1	NA	3
1	2	NA
1	2	3
3	NA	6
4	5	9
7	5	6
7	8	9
NA	7	9


How can i construct a new data frame that only contains those rows that
does not contain the NA's? is these a quick way?

ie

x1	x2	x3
1	2	3
4	5	9
7	5	6
7	8	9


in this example we can simple use a[c(-1,-2,-4,-8),] but happens if we
have a larger dataframe?

we need to construct some kind of row indicator telling R which rows
contains NA'S.

is there an easier method?

/
allan


More information about the R-help mailing list