I have hundreds of P values which correspond to row names in my data frame. I put those values into a new row of the original table:
df1$Pvalues<-lapply(1:nrow(data1), function(i) {
wilcox.test(as.numeric(data1[i, ]), as.numeric(data2[i, ]))$p.value
}))
I found the top 20 most significant P values and now need to find out which column name they correspond to. I have tried:
which(rownames(df1) %in% c("1.136925e-12"))
But the answer given is integer(0)
Another way would be to print the top 20 most significant P values along with column names straight away but all I have is the actual P values. In this command wilcoxon
is the name of the dataframe where I have subset the P values:
head(sort(wilcoxon),20)
I'm a beginner, any help would be appreciated!