[R] Extracting unique entries by a column
Vikram Chhatre
crypticlineage at gmail.com
Tue Apr 14 21:39:50 CEST 2015
I have a data frame of dim 3x600. There are pairs of rows which have the
exact same value in column 3.
head(df)
POP1 POP2 ABSDIFF
L0005.01 0.98484848 0.688118812 0.2967297
L0005.03 0.01515152 0.311881188 0.2967297
L0008.02 0.97727273 0.004424779 0.9728479
L0008.04 0.02272727 0.995575221 0.9728479
L0012.03 0.98684211 0.004385965 0.9824561
L0012.01 0.01315789 0.995614035 0.9824561
I want to unique sort on df$ABSDIFF so that only one row per pair remains
in the subset.
>df_subset <- df[df(!duplicated(df$ABSDIFF), ]
This does not work. So I literally checked:
>identical(df[1,3], df[2,3])
FALSE
How is 0.2967297 different from 0.2967297? I am puzzled.
Thanks for any insight.
Vikram
[[alternative HTML version deleted]]
More information about the R-help
mailing list