I have a dataset which looks like the following-
cluster1 cluster2 cluster3
0.0795604798 0.0934697636 -0.396044650
0.0086171605 -0.1467907623 -0.396044650
1.8838058726 -0.1507548515 -0.396044650
I want to get the cluster number for each row, which will be the maximum value. It should look something like this-
value cluster
0.0934697636 cluster2
0.0086171605 cluster1
1.8838058726 cluster1
I'm doing it in R. If I use the following command, I get the maximum observation from each row-
k=colnames(apply(cscore,1,max))
But I'm not sure how to get the cluster name as well.