Filtering a dataframe in row names from a column value in R

Posted by user1755155 on Stack Overflow See other posts from Stack Overflow or by user1755155
Published on 2012-10-18T04:50:06Z Indexed on 2012/10/18 5:02 UTC
Read the original article Hit count: 236

Filed under:
|

Basically I have dataframe with two columns (target_id and fpkm). I want to keep only those row names in first column that are not duplicated.
For example in the below dataframe you can see there are two row names with the same name (almost) comp267138_c0_seq1 comp267138_c0_seq2 and from both and I want to keep only one comp267138_c0_seq2 based of high value in column 2.

       target_id        fpkm

comp247393_c0_seq1    3.197885

comp257058_c0_seq4    1.624577

comp242590_c0_seq1    1.750319

comp77911_c0_seq1     1.293059

comp241426_c0_seq1    1.626589

comp288413_c0_seq1   14.828853

comp294436_c0_seq1   11.555596

comp63603_c0_seq1     1.982386

comp267138_c0_seq1    8.594494

comp267138_c0_seq2   11.134958

comp321623_c0_seq1    6.934149

© Stack Overflow or respective owner

Related posts about filtering

Related posts about data.frame