In the following example, I want to write the residuals plot of each model in a file. I do not need to see them in my display.
for (i in 1:500){
temp.model<-lme(as.formula(paste("Var",i) ~ X1*X2, sep=""), data = example, random=~1| Exp/Person)
jpeg(paste("C:/Myfolder", i, ".jpg", sep = ""), quality=50, bg="white")
plot(temp.model)
dev.off ()
graphics.off()
}
When I run this code without loop, I obtain what I want. However, it creates blank files within the loop.
Any ideas?
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…