[R] Removing redundant observations

Barbara mart1152 at umn.edu
Fri Sep 4 02:07:19 CEST 2009


Hello R-helpers,

I am having a difficult time figuring out the following: I have a data 
frame with 24 variables. I need to remove redundant observations where, 
within the same values of ID, V2 is equal to another observation in V2.

 >ID  V2  
 >1    23.9
 >1    NA
 >1    22.0
 >1   23.9
 >2   0.4
 >2  NA
 >2  NA
 >2  3.0
 >2  0.4

Thus, the new data frame would look like this (plus the other 22 variables):

 >ID  V2  
 >1    23.9
 >1    NA
 >1    22.0
 >2   0.4
 >2  NA
 >2  3.0

Thank you in advance,
Barb




More information about the R-help mailing list