I put bmp() before the plot() syntax , then the code worked.
Bin Yue wrote: > > Dear all: > I hope that the file in which the picture is stored has the same name > as the " main" title of the picture . But it turns out that , the name of > the file is :names(spl.sp)[i].bmp,while the main title of the picture is > names(spl.sp)[i+1] > It seems that the problem is related to the "device". But I am finding it > very difficult to understand . > Do you have any idea about that? > > Here is my function: > > sp.drawK<-function(spl.sp){ > env<-list() > for(i in 1:length(spl.sp)){ > if(spl.sp[[i]]$n==1) next > else{ > env[[i]]<-envelope(spl.sp[[i]],Kest) > plot(env[[i]],main=names(spl.sp)[i]) > legend("topleft",lty=1:4,col=1:4,legend=c("obs","theo","hi","lo")) > text(2,500,cex=0.8, paste("n=",spl.sp[[i]]$n,sep="")) > bmp(paste(names(spl.sp)[i],".bmp",sep="")) > > } > } > } > > Best wishes, > Bin Yue > > ----- Best regards, Bin Yue ************* student for a Master program in South Botanical Garden , CAS -- View this message in context: http://www.nabble.com/restore--pictures-in-an-automatically-named-files-using-loops-tp14370153p14370262.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.