Possible Duplicate:
How to print R graphics to multiple pages of a PDF and multiple PDFs?
I am new to R and have a quick question. The following code writes one .pdf file for each graph. I would like to add figures one after another in ONE pdf file. Thank you so much. Greatly appreciate any help.
i=5
while (i<=10)
{
name1="C:\\temp\\"
num=i
ext = ".pdf"
path3 = paste(name1,num,ext)
par(mfrow = c(2,1))
pdf(file=path3)
VAR1=rnorm(i)
VAR2=rnorm(i)
plot(VAR1,VAR2)
dev.off()
i=i+1
}