Skip to content
Prev 366698 / 398503 Next

T tests on multiple groups

Hi Ed,
It's little hard to work out exactly what you want, but here's a guess:

esdf<-data.frame(GENO=rep(c("control","A","B","AB"),each=20),
 age=rep(c(10,20),40),OBS=runif(80,1,21))
for(age in c(10,20)) {
 for(geno in c("A","B","AB"))
  print(t.test(OBS~GENO,esdf[esdf$age==age &
   esdf$GENO %in% c("control",geno),]))
}

Note that this is not a good way to use t.test, nor a good way to
analyze data like this. Look at defining sensible contrasts and using
ANOVA or a similar approach.

Jim
On Fri, Jan 20, 2017 at 5:20 AM, Ed Siefker <ebs15242 at gmail.com> wrote: