Dear all,
I'm a new R user and I find myself in trouble with some of the plot
functions.
I'm trying to save a sequence of plots to eps files using a for loop, but I
get only empty figures.
In each iteration of the for loop I fit a nlme model and I'd like to plot
its prediction of the dependent variable values.
This is the code I'm using to plot the figures (I removed the commands I use
to fit the model, but they are OK)
postscript(file="saReg%03d.eps",onefile=FALSE)
for (i in 1:length(names(DatasetSa))) {
#[...]
plot(augPred(DatasetGrp.fit,primary = ~R, level =
0:1),title=names(DatasetSa)[i])
#[...]
}
dev.off()
When I run this code I only get one empty figure even though the loop is
executed 70 times. If I try to run the command
plot(augPred(DatasetGrp.fit,primary = ~R, level =
0:1),title=names(DatasetSa)[i])
outside the loop everything goes fine.
I also tried to open and close a device in each loop iteration,
for (i in 1:length(names(DatasetSa))) {
#[...]
fignam <- paste("SaReg",i,sep=".");
fignam <- paste(fignam,".eps",sep="");
postscript(file=fignam)
tempData<-augPred(DatasetGrp.fit,primary = ~R, level = 0:1)
plot(tempData)
dev.off()
#[...]
}
in that case I get the correct number of eps files but they are all empty.
I would really appreciate you help.
Thank you,
NB
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.