r - How can I plot multiple residuals plots in a loop? -
in next example, want write residuals plot of each model in file. not need see them in display.
for (i in 1:500){ temp.model<-lme(as.formula(paste("var",i) ~ x1*x2, sep=""), info = example, random=~1| exp/person) jpeg(paste("c:/myfolder", i, ".jpg", sep = ""), quality=50, bg="white") plot(temp.model) dev.off () graphics.off() }
when run code without loop, obtain want. however, creates blank files within loop.
any ideas?
thank you.
the reply in faq, faq 7.22 in fact. not obvious until realize plot.lme
function nlme bundle uses lattice/trellis graphics actual plotting (there references on help page plot.lme
, not obvious).
the short form of solution (but still recommend reading faq , other documentation understand issue) wrap plot
in print
command.
r plot anova mixed-models
No comments:
Post a Comment