Re: [R] a loop for boxplot graphs

2009-03-29 Thread Coen van Hasselt
Oops, the example only accounts for 1 observation, so better do something like this in that case: .. for (i in unique(dat$id)){ .. On Mon, Mar 30, 2009 at 07:50, Coen van Hasselt wrote: > You could use the paste() function to dynamically assign label values. > For instance, like this: > > dat<-da

Re: [R] a loop for boxplot graphs

2009-03-29 Thread Coen van Hasselt
You could use the paste() function to dynamically assign label values. For instance, like this: dat<-data.frame(id=1:4,x=1:4,y=1:4) par(mfrow=c(2,2)) for (i in dat$id){ boxplot(dat$x[dat$id==i], dat$y[dat$id==i], main=paste("Results for Subject",i) ) } There might be a better

[R] a loop for boxplot graphs

2009-03-29 Thread James Lenihan
Dear Colleagues   I have the following code that generates a boxplot for one specific labtest:   boxplot.n(LBSTRESN~COHORT, main="Boxplot of laboratory data for XLXXX-XXX test=Creatinine", subset = LBTEST=="Creatinine", xlab = "Cohort Number", ylab = "Units = umol/L", varwidth=TRUE   I would lik