Dear R-experts, I have a dataset of 4 patients and each patient has many records at four different time points. I have done 4 different qqnorm plots on the same graph where each plot represents the records of one patient at each time point. I would like to do the same graph for the remaining patiens, but instead of repeating the below procedure three more times I would like to have a for loop so when I run the loop I would get four graphs of the four patients at the same time, where each graph has 4 different qqnorm plots representing the data at four time points for each patient. I tried to do the loop but couldn't make it work. below is the code used to the graph for one patient. sli-4 - sli_7 contain records at four time points. dat=dataset, y=records, Slide=time point ### Patient 200004 sli_4=dat$y[dat$Slide==4 & dat$Control==0] sli_5=dat$y[dat$Slide==5 & dat$Control==0] sli_6=dat$y[dat$Slide==6 & dat$Control==0] sli_7=dat$y[dat$Slide==7 & dat$Control==0] ### qq-plot of patient 200004 q_sli4<-qqnorm(sli_4,plot.it=FALSE) q_sli5<-qqnorm(sli_5,plot.it=FALSE) q_sli6<-qqnorm(sli_6,plot.it=FALSE) q_sli7<-qqnorm(sli_7,plot.it=FALSE) plot(range(q_sli4,q_sli5,q_sli6,q_sli7),range(q_sli4,q_sli5,q_sli6,q_sli7),type="n", xlab = "Theoretical Quantiles",col.main="blue", main = "Normal Q-Q Plot of index for patient 200004",ylab = "Sample Quantiles") points(q_sli4,col=4,pch=0,cex=1) points(q_sli5,col=3,pch=1,cex=1) points(q_sli6,col=2,pch=2,cex=1) points(q_sli7,col=1,pch=3,cex=1) legend("topleft",c("Day 0", "56 days","112 days", "252 days"),col=c(4,3,2,1), text.col=c(4,3,2,1),pch=c(0,1,2,3),bg="bisque") abline(0,0) Thanks alot for your help, All the bests, Jenny ---------------------------------
--------------------------------- [[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.