不确定我是否理解。附加到同一文件(每页一个图):pdf("myOut.pdf")for (i in 1:10){ plot(...)}dev.off()每个循环的新文件:for (i in 1:10){ pdf(paste("myOut",i,".pdf",sep="")) plot(...) dev.off()}
pdf(file = "Location_where_you_want_the_file/name_of_file.pdf", title="if you want any")plot() # Or other graphics you want to have printed in your pdfdev.off()您可以在pdf中绘制任意数量的图,这些图将在不同页面中添加到pdf中。dev.off()关闭与文件的连接,将创建pdf文件,您将看到类似> dev.off()null device 1