[R] Choosing the larger of row pairs
jamesrome at gmail.com
Thu Mar 25 02:10:58 CET 2010
I have a data frame with some rows that are almost, but not quite
duplicates of each other.
By using duplicated(key) on one column and on the column reversed, I can
get 2 columns in my data frame that have adjacent rows with TRUE. For
key value d di ......
1 1 FALSE FALSE
2 0 FALSE TRUE #Eliminate this row
2 2 TRUE FALSE
3 0 FALSE FALSE
4 0 FALSE FALSE
5 1 FALSE FALSE
6 3 FALSE TRUE
6 2 TRUE FALSE #Eliminate this row
7 0 FALSE FALSE
. . .
I want to eliminate the row with the lower value in adjacent rows that
have TRUE. And in principal, I could have more than 2 duplicate rows
next to each other.
How can I do this?
More information about the R-help