Hi, Two queries, if I may ask:
A. I wish to retrieve the p-values from wilcox test for EACH gene --- such that Samples 1-3 is considered as one group while the rest remains in the other group. There is 1013 genes in the dataframe as attempted to exemplify in the table below. |Sample 1 | Sample2 | sample3 | SDample4 | sample 5 | sample 6 _________________________________________________________________________ Gene 1 | 2.4 | 3.5 | 4.2 | 6.2 | 2.4 | 6.3 Gene 2 | 6.4 | 6.5 | 2.2 | 8.2 | 4.4 | 2.3 ---- ----- Gene 1013 | 1.4 | 2.5 | 3.2 | 4.2 | 5.4 | 7.3 Accordingly, the following function is made. funn <- function (x,y) { for (i in 1:1013) { wil <- wilcox.test(as.numeric(x), as.numeric (y), paired=TRUE); print (wil); } return (wil); } However, I think it is somewhat incorrect as commands like the following generates several warnings (and it gives more than just the p-value). funn (c(file [,1]:file [,3]), c(file[,4]:file [,6])) # "file" is the dataframe. B. Any good books/weblink you could advise which focus more on the programming side of r, such as function-building ? The few books that I have gone thorugh have very less on such aspect - they focus more on statistical aspects and use of built-in functions. Thank you. Cheers, Chintanu [[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.