Skip to content
Prev 314773 / 398502 Next

how to aggregate T-test result in an elegant way?

Hi Yao,

You could also have the results in a wide format:
res<-do.call(rbind,lapply(lapply(split(b,b$variable),function(x) t.test(x$value[x$O2=="13%"],x$value[x$O2=="21%"])),function(x) data.frame(mean13=x$estimate[1],mean21=x$estimate[2],p.value=x$p.value,CILow=x$conf.int[1],CIHigh=x$conf.int[2])))
?res
#????????? mean13?? mean21??? p.value???? CILow??? CIHigh
#EMW???? 14.35000 17.68000 0.09355374 -7.682686? 1.022686
#EW.17.5 42.87000 45.97333 0.17464018 -9.265622? 3.058955
#EW.INCU 49.61333 47.08333 0.43689727 -7.119234 12.179234
A.K.




----- Original Message -----
From: Yao He <yao.h.1988 at gmail.com>
To: arun <smartpink111 at yahoo.com>
Cc: R help <r-help at r-project.org>
Sent: Monday, January 7, 2013 10:57 AM
Subject: Re: [R] how to aggregate T-test result in an elegant way?

Hi,arun

Yes , I just want to do the t.test
I think maybe? it is not necessary to generate a 3D array from the raw
data.frame by acast() at first

Thanks a lot

2013/1/7 arun <smartpink111 at yahoo.com>: