Re: [R] add mean and sd to dotplot in each panel using lattice

2011-02-11 Thread Xiaokuan Wei
PM Subject: Re: [R] add mean and sd to dotplot in each panel using lattice Xiaokuan - Maybe this will get you started: mypanel = function(x,y,...){ agg<-aggregate(y,list(x),function(x)c(mean(x,na.rm=TRUE),sd(x,na.rm=TRUE))) mns = agg[,2][,1] sds = agg[,2][,2] for(i in 1:nr

Re: [R] add mean and sd to dotplot in each panel using lattice

2011-02-09 Thread Phil Spector
Xiaokuan - Maybe this will get you started: mypanel = function(x,y,...){ agg<-aggregate(y,list(x),function(x)c(mean(x,na.rm=TRUE),sd(x,na.rm=TRUE))) mns = agg[,2][,1] sds = agg[,2][,2] for(i in 1:nrow(agg))llines(c(i-.1,i+.1),rep(mns[i],2),lwd=3) for(i in 1:nrow(agg)){llines(c(i

[R] add mean and sd to dotplot in each panel using lattice

2011-02-09 Thread Xiaokuan Wei
Hi, I have a data frame like this: ScoreDoseSex 2.81Dose1M 1.81Dose1M 1.22Dose1M 0.81Dose1M 0.49Dose1M 0.22Dose1M 0.00Dose1M -0.19Dose1M -0.17Dose1F -0.32Dose1F -0.46Dose1F -0.58Dose1F -0.70Dose1F -0.81Dose1F -0.91Dose1F -1.00Dose1F -1.77Dose2M -1.85Dose2M -1.93Dose2M -2.00Dose2M -2.07Dose2M -2.14