[R] darcs patch: Apply on data frame

2011-02-17 Thread Sébastien Bihorel
Hi, You need to add parentheses around your return argument. (Please, note that your example is not successfully because of data problem). 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) } [[alternati

Re: [R] darcs patch: Apply on data frame

2011-02-17 Thread Mohamed Lajnef
Hi chen, avoid naming the function with specific expressions (:,;.) and try this code as follow Scripranksum<- 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) } Best Mohamed Le 17/02/11 08:15, Mr rong chen a écri

[R] darcs patch: Apply on data frame

2011-02-17 Thread Mr rong chen
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 symbo