Skip to content
Prev 309850 / 398506 Next

select duplicate identifier with higher mean across sample columns

Is this what you want:
+ 1  A   100   110    110
+ 2  A   120   130    150
+ 3  C   101   131    151
+ 4  D   110   150    130
+ 5  E   132   122    122
+ 6  F   123   143    143", header = TRUE)
+     maxIndx <- which.max(rowMeans(.id[, -1L]))
+     .id[maxIndx, ]
+ }))
id samp1 samp2 samp2a
A  A   120   130    150
C  C   101   131    151
D  D   110   150    130
E  E   132   122    122
F  F   123   143    143


On Sun, Nov 4, 2012 at 2:25 PM, Adrian Johnson
<oriolebaltimore at gmail.com> wrote: