[R] Effect of na.omit()

James Rome jamesrome at gmail.com
Tue Dec 29 22:11:38 CET 2009


I had an NA in one row of my data frame, so I called na.omit(). But I do
not understand where that row disappeared to.

>fri=na.omit(fri)
> fri
      Date.Only    DAY Hour Min15 Quarter Arrival.Val Arrival4
1    09/05/2008 Friday    8    33       3          32        8
2    10/24/2008 Friday   21    86       4          28        7
3    10/31/2008 Friday    8    33       4          20        5
4    10/31/2008 Friday    8    34       4          20        5
5    10/31/2008 Friday    8    35       4          12        3
....
1233 08/28/2009 Friday    0     2       3          12        3
1234 09/18/2009 Friday   22    92       3           8        2
1235 09/18/2009 Friday   23    93       3          20        5
> fri[1235,]
   Date.Only  DAY Hour Min15 Quarter Arrival.Val Arrival4
NA      <NA> <NA>   NA    NA      NA          NA       NA
> fri[1234,]
      Date.Only    DAY Hour Min15 Quarter Arrival.Val Arrival4
1235 09/18/2009 Friday   23    93       3          20        5

So, the index numbers of the rows do not seem to have been updated. They
are not part of my data frame (I think), so why didn't the rows renumber
themselves?

Thanks,
Jim Rome




More information about the R-help mailing list