library(Hmisc,T) library(lattice) dat <- sasxport.get("//Cdsesub1/n50803/N_000/2004-08-23/crt/datasets/vlc.c.304/A_EFF.XPT") #Make missing be denoted as NA levels(dat$dry)[levels(dat$dry)%in%""] <- NA levels(dat$eryth)[levels(dat$eryth)%in%""] <- NA levels(dat$scal)[levels(dat$scal)%in%""] <- NA levels(dat$burn)[levels(dat$burn)%in%""] <- NA levels(dat$itch)[levels(dat$itch)%in%""] <- NA dat$dryn <- as.numeric(dat$dry) dat$erythn <- as.numeric(dat$eryth) dat$scaln <- as.numeric(dat$scal) dat$burnn <- as.numeric(dat$burn) dat$itchn <- as.numeric(dat$itch) skinval <- with(dat, c(dryn, erythn, scaln, burnn, itchn)) skinpar <- rep(c('Dryness','Erythema','Scaling','Burning','Itching'), each=dim(dat)[1]) skinvisit <- rep(dat$visit, 5) skintrt <- rep(dat$txname, 5) ss <- summarize(skinval, llist(skinpar, skintrt, skinvisit), function(x)mean(x, na.rm=TRUE)) #png('C:/Research/Graphics/Graphs4Display/webpages/classes/pages/images/local50803.png', # width=550, height=550) new.back <- trellis.par.get("background") new.back$col <- "white" newcol <- trellis.par.get("superpose.symbol") newcol$col <- c('blue','green4','black','red' ) newcol$pch <- c(16,17,4,8) new.line <- trellis.par.get("superpose.line") new.line$col <- c('blue','green4','black','red' ) new.line$lty <- c(1,1,1,1) new.pan <- trellis.par.get("strip.background") new.pan$col <- c('gray90','white') trellis.par.set("background", new.back) trellis.par.set("superpose.symbol", newcol) trellis.par.set("superpose.line", new.line) trellis.par.set("strip.background",new.pan) xyplot(skinval ~ skinvisit|skinpar, groups=skintrt, data=ss, type='o', scales=list(y=list(at=seq(1,2,.25), labels=Cs('none (0)','1.25','1.5','1.75','mild (1)')), x=list(at=1:5, labels=Cs(0,2,4,8,12))), xlab="Week", ylab="Mean Value", xlim=c(.5,5.5),ylim=c(.95,2.05), key=list(x=.725,y=.8, lines=list(type='o', col=trellis.par.get("superpose.symbol")$col[1:4], lty=trellis.par.get('superpose.line')$lty[1:4], pch=trellis.par.get('superpose.symbol')$pch[1:4], size=2), text=list( lab=levels(ss$skintrt), col=trellis.par.get('superpose.line')$col[1:4]), columns=1, title='Treatment', cex=.8, cex.title=1), aspect=1) #dev.off()