Skip to content
Prev 334774 / 398506 Next

Calculating group means

On 12/23/2013 11:31 PM, Laura Bethan Thomas [lbt1] wrote:
Hi Laura,
You can do it like this:

# make up enough data to do the calculation
lbtdat<-data.frame(subject=rep(1:13,each=160),
  condition=rep(rep(rep(1:10,each=8),2),13),
  state=rep(rep(1:8,20),13),
  latency=sample(600:1100,2080,TRUE))
by(lbtdat$latency,list(lbtdat$subject,
  lbtdat$condition,lbtdat$state),mean)

but you are going to get a rather long list of means.

Jim