[R] a loop question

Susan Lin susan_lin99 at yahoo.com
Fri Feb 27 22:09:40 CET 2004


I want to get three .gif image files test.1.gif,
test.2.gif, & test.3.gif by using a loop. The code I
tried  is like this:
      x=c(0, 1, 2, 3, 4)
      y=c(1, 2, 3, 4)
      for(i in 1:3)
      {
        x11()
        jpeg("test.i.gif")
        plot(x, y)
        dev.off()

      } 
but I only could get one image file, test.i.gif. How
can I get three image files?

Thanks.




More information about the R-help mailing list