Greetings, I cannot find solution for this problem (I was searching on web, but without success):
I want to plot dose-response models for one concentration and many responses (lets say 200) and I don´t want to do it manually. So I use loop for this: for (i in mydata[,2:201]){ #first column is concentration pdf(paste("plot_",i,".pdf",sep = "")) plot(i~concentration,log='x') ht <- seq(0,5000,1) lines(ht, predict(selectedmodel, data.frame(concentration = ht))) #I previously selected appropriate model for each column within loop #(I don´t want to write here the whole loop with model selection) dev.off() } This seems, that it works (I obtain many pdf files with plots), but there is problem with names of these files. R uses random numbers as names , but after some files (more than 49) one of the selected names is '0' . And after few other files, there is the same name ('0') again. So the previous file is overwritten and it is lost. And this is repeated many times (so many plots are lost). And there is also name '1' doing the same thing... I really do not know how to solve it... I also tried pdf(paste("plot_",names[i],".pdf",sep = "")) But it does not help (still random number as names are selected) ... I would be really happy if someone could help me with this... Thank you very much, Sona -- View this message in context: http://r.789695.n4.nabble.com/problems-with-saving-plots-from-loop-tp4667616.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org 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.