Re: [R] Fwd: Calculating group means

2013-12-23 Thread Bert Gunter
Jim: Did you forget about with() ? Instead of: by(lbtdat$latency,list(lbtdat$subject, lbtdat$condition,lbtdat$state),mean) ##do with(ibtdat,by(latency,list(subject,condition,state),mean)) Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not w

Re: [R] Fwd: Calculating group means

2013-12-23 Thread Jim Lemon
On 12/23/2013 11:31 PM, Laura Bethan Thomas [lbt1] wrote: Hi All, Sorry for what I imagine is quite a basic question. I have been trying to do is create latency averages for each state (1-8) for each participant (n=13) in each condition (1-10). I'm not sure what function I would need, or what

Re: [R] Fwd: Calculating group means

2013-12-23 Thread arun
Hi, You could either try: #dat1 ##dataset aggregate(latency~.,data=dat1,mean) #or  library(data.table)  dt1 <- data.table(dat1,key=c('subject','conditionNo','state'))  dt1[,mean(latency),by=c('subject','conditionNo','state')] A.K. On Monday, December 23, 2013 2:20 PM, Laura Bethan Thomas [lbt

Re: [R] Fwd: Calculating group means

2013-12-23 Thread Charles Determan Jr
I would suggest using summaryBy() library(doBy) # sample data with you specifications subject <- as.factor(rep(seq(13), each = 5)) state <- as.factor(sample(c(1:8), 65, replace = TRUE)) condition <- as.factor(sample(c(1:10), 65, replace = TRUE)) latency <- runif(65, min=750, max = 1100) dat <- da

[R] Fwd: Calculating group means

2013-12-23 Thread Laura Bethan Thomas [lbt1]
> Hi All, > > Sorry for what I imagine is quite a basic question. I have been trying to do > is create latency averages for each state (1-8) for each participant (n=13) > in each condition (1-10). I'm not sure what function I would need, or what > the most efficient ay of calculating this woul