Thanks. I'm gonna give it a try
• 0 views
•
link
I have a list of genes that I want to rank them based on two other features(P&Z column) using robust rank aggregation, see below:
my_dataTable:
gene_name P Z
x 6.3 0.08
y 5.6 0.009
z 3.4 0.04
w 2.6 0.0085
In aggregate() method we can assign other columns to the genes, e.g. aggregate(gene_name~P+Z, my_dataTable , median), but how can I do the same in robust rank aggregation method?
could anyone help me with this?
How about:
my_dataTable <-
data.frame(gene_name=c("x", "y", "z", "w"),
P=c(6.3, 5.6, 3.4, 2.6),
Z=c(0.08, 0.009, 0.04, 0.0085))
library(RobustRankAggreg)
#/ make the glist with the ordered gene names:
glist <- list(P=my_dataTable[order(my_dataTable$P),"gene_name"],
Z=my_dataTable[order(my_dataTable$Z),"gene_name"])
#/ aggregate by ranks:
aR <- aggregateRanks(glist=glist)
#/ match order in aR with my_dataTable:
matched <- match(aR$Name, my_dataTable$gene_name)
#/ order my_dataTable accordingly:
my_dataTable[matched,]
Thanks. I'm gonna give it a try
Log in to answer this question.