[R] filter on data frame

Michael A. Miller mmiller3 at iupui.edu
Wed Dec 11 19:37:02 CET 2002


>>>>> "AlessandroSemeria" == AlessandroSemeria  <AlessandroSemeria at cramont.it> writes:

    > Hello R-list.  Someone know how to delete rows on a
    > char/num matrix following some criteria without a loop
    > (something like: my.matrix[my.matrix [,4]<1e-5], but this
    > one put within rows, that follow citeria, "NA")?  Thanks!

How about subset and is.na?

Mike

> df
  V1   V2
1  1    a
2  2    b
3  3    f
4  4    g
5  5 <NA>
6  6 <NA>
7  7    a
> subset(df,!is.na(V2))
  V1 V2
1  1  a
2  2  b
3  3  f
4  4  g
7  7  a




More information about the R-help mailing list