Re: [R] t-test across columns

2013-07-15 Thread arun
Nico Met' ; 'R help' Cc: Sent: Monday, July 15, 2013 1:33 PM Subject: Re: [R] t-test across columns This may be close to what you want: > t.val <- by(x, x$cat, function(y) if (min(table(y$name)>1)) { +      t.test(val~name, y)}) > t.out <- do.call(rbind, sapply(t.val, f

Re: [R] t-test across columns

2013-07-15 Thread David Carlson
This may be close to what you want: > t.val <- by(x, x$cat, function(y) if (min(table(y$name)>1)) { + t.test(val~name, y)}) > t.out <- do.call(rbind, sapply(t.val, function(y) c(y$statistic, + p.value=y$p.value))) > t.out t p.value p178266580 -0.1156475 0.91440

Re: [R] t-test across columns

2013-07-15 Thread arun
Hi, Not sure about the format for the 2nd part. df1<- ##data library(plyr) df2<-ddply(df1,.(name,cat),summarize, cbind(t.test(val,df1$val)$statistic,t.test(val,df1$val)$p.value))  df3<-cbind(df2[,1:2],data.frame(df2[,3]))  colnames(df3)[3:4]<- c("t-val","p.val") library(reshape2) df3m<-  melt(df3