Hi all, I have found the following function online
median.test<-function(y1,y2){ z<-c(y1,y2) g <- rep(1:2, c(length(y1),length(y2))) m<-median(z) fisher.test(z<m,g)$p.value } in http://www.mail-archive.com/r-help@r-project.org/msg95278.html I have the following data > group1 <- c(2, 2, 2, 1, 4, 3, 1, 1) > group2 <- c(3, 1, 3, 1, 4, 1, 1, 1, 7, 1, 1, 1, 1, 1, 2) > median.test(w1,group1) [1] 1 > median.test(group1,group2) Error in fisher.test(z < m, g) : 'x' and 'y' must have at least 2 levels I am very thankful in advance for any suggestion and help. Regards, Linda [[alternative HTML version deleted]] ______________________________________________ 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.