Hi, Try: fun1 <- function(dat){ mat1 <- combn(colnames(dat1),2) res <- sapply(seq_len(ncol(mat1)),function(i) {x1<- dat[,mat1[,i]]; wilcox.test(x1[,1],x1[,2])$p.value}) names(res) <- apply(mat1,2,paste,collapse="_") res }
set.seed(432) dat1 <- as.data.frame(matrix(sample(18*10,18*10,replace=FALSE),ncol=18)) fun1(dat1) #gives the p-value for each pair of columns Hi, I want to make a wilcoxon test, i have 18 columns each column corresponds to a different sample and i want to compare one to each other with a wilcoxon test in one step this is possible ? or do i compare two by tow? Does it exist a code for automation this test? like this i dont have to type the code for each couple. thanks! denisse ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.