Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 212041

Pick row with highest value and return rowname

$
0
0

For each column I would like to select the rowname that has the highes value across all rows. Please see my input and output example.

> df.t[,1:5][1:5,]
                MMRF_1021 MMRF_1024 MMRF_1029 MMRF_1030 MMRF_1031
ENSG00000004468  8.195680  7.500753  7.912472  8.886945  6.780892
ENSG00000081237  4.401101  6.135663  6.525512  4.496787  7.927844
ENSG00000139193  6.124573  6.585169  5.547023  6.254043  2.764494
ENSG00000156738 -1.491527  2.237000  7.192401  8.032151 -4.253239
ENSG00000174059 -5.663732 -4.477220 -5.663732 -4.237282 -4.792564

out

MMRF_1021 ENSG00000004468
MMRF_1024 ENSG00000004468
MMRF_1029 ENSG00000004468 
MMRF_1030 ENSG00000004468
MMRF_1031 ENSG00000081237 

Viewing all articles
Browse latest Browse all 212041

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>