r - Wilcoxon test on a large dataset algorithm -


i have large dataset: each row sample , each column feature. first column filled class factors (which here 1,2,3,4,5). aim wilcoxon comparison between classes (so every combination 1,2:1,3;1,4;1,5;2,3...) features. code wrote in order (x dataframe)

facs <- length(levels(factor(x[,1])))  v <- matrix(as.character(combn(facs,2)),ncol=facs*2)  vecboh <- data.frame(row.names=paste(v[1,],"-",v[2,]))  for(i in 2:ncol(x)) {      wilf <- function(coppie)  wilcox.test(x[,i] ~ class, data=x, subset = class %in% coppie)       vecboh[,i-1] <- as.numeric(sapply(apply(v,2,wilf),"[",3)) } 

it works it's extremely slow. have feeling there's quicker way this. have clue?

you can use pairwise.wilcox.test function pairwise comparison between groups , think reading multiple comparison before can here.

lapply(df[,-1], function(x)                    pairwise.wilcox.test(x, df$class, p.adjust.method = "none")) 

where df data.frame


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -