I have a data frame which looks like this:
structure(list(Mash_pear = c(0.192474082559755, 0.679726904159742,
0.778564545349054, 0.573745352397321, 0.56633658385284, 0.472559997318901,
0.462635414367878, 0.562128414492567, 0.354624921832056, 0.64532681437697
), tRap_pear = c(0.0350096175177328, 0.234255507711743, 0.23714999195134,
0.185536020521134, 0.191585098617356, 0.201402054387186, 0.220911538536031,
0.216072802572045, 0.132247101763063, 0.172753098431029), Beeml_pear = c(0.179209909971615,
0.79129167285928, 0.856908302056589, 0.729078080521886, 0.709346164378725,
0.669599784720647, 0.585348196746785, 0.639355942917055, 0.544909349368496,
0.794652394149651), Mash_pear2080 = c(0.823944540480775, 0.816630852343513,
0.81134728399675, 0.801065036203532, 0.799630945085954, 0.799195606444727,
0.798637867344115, 0.798478922129054, 0.798090734787886, 0.797673368802285
)), .Names = c("Mash_pear", "tRap_pear", "Beeml_pear", "Mash_pear2080"
), row.names = c("Aft1", "Alx3_3418.2", "Alx4_1744.1", "Arid3a_3875.1_v1_primary",
"Arid3a_3875.1_v2_primary", "Arid3a_3875.2_v1_primary", "Arid3a_3875.2_v2_primary",
"Arid5a_3770.2_v1_primary", "Arid5a_3770.2_v2_primary", "Aro80"
), class = "data.frame")
Now i had the idea to rank those scores, but every columns should be ranked separately with keeping the row names intact. So i tried to extract all the columns 1 by 1 and order them. The problem i'm experiencing is occurring when trying to order 1 column. Namely my dataframe disappears and becomes a vector of numeric values and as i already pointed out, i need the data frame (rownames) to stay as is, only ordered. The code i'm working on right now is here:
rowname<-rownames(pearframe)
col1<-subset(pearframe, select=1)[order(pearframe),]
col2<-subset(pearframe, select=2)[order(pearframe),]
col3<-subset(pearframe, select=3)[order(pearframe),]
col4<-subset(pearframe, select=4)[order(pearframe),]
THIS removes my rownames and orginal data frame structure. Which makes it impossible to rank my data. So the actual question would be: How can i order/sort a data frame per column and create 4 new frames with 1 ordered column each. Eventually i want to have a table which exists of the rownames of every ranked frame and the scores.