Hi,
I am using a very simple R function to get each row from the attached file and run Wilcox.test between columns 1-3 and 4-12. However, I keep getting an error message. The data files is attached. Any suggestion? Thank you. Rong Error message: + return c$p.value Error: unexpected symbol in: " c <- wilcox.test(a[g1], a[g2]) return c" Execution halted Scrip:ranksum <- function(a){ g1 <- c(1, 2, 3) g2 <- c(4, 5, 6, 7, 8, 9, 10, 11, 12) c <- wilcox.test(a[g1], a[g2]) return c$p.value } data1 <- data.frame() data1 <- read.table("test.txt", sep="\t", header=T) p <- apply(data1, 1, ranksum) write.table(p, file="test_p.out")
dbSNP JPT CHB CHD GIH MEX TSI CEU ASW MKK LWK YRI 12565286 0.852 0.967 0.971 0.926 0.974 0.94 0.968 0.945 0.919 0.995 0.993 12565286 0.148 0.033 0.029 0.074 0.026 0.06 0.032 0.055 0.081 0.005 0.007 3131972 0.274 0.237 0.197 0.218 0.259 0.152 0.168 0.605 0.609 0.655 0.795 3131972 0.726 0.763 0.803 0.782 0.741 0.848 0.832 0.395 0.391 0.345 0.205 3131969 0.387 0.272 0.252 0.178 0.233 0.098 0.137 0.555 0.593 0.639 0.738 3131969 0.613 0.728 0.748 0.822 0.767 0.902 0.863 0.445 0.407 0.361 0.262 1048488 0.142 0.107 0.093 0.19 0.19 0.152 0.17 0.526 0.471 0.5 0.634 1048488 0.858 0.893 0.907 0.81 0.81 0.848 0.83 0.474 0.529 0.5 0.366 12562034 0.573 0.515 0.514 0.706 0.931 0.885 0.898 0.902 0.828 0.877 0.923
______________________________________________ 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.