Skip to navigation

R: create several plots with automatic generation of filenames in a loop

Found on stackoverflow.com. I didn’t know about this way to make R automatically generate filenames for a series of plots:

jpeg("~/tmp/rplots/foo%02d.jpg")
for (i in 1:5) {
    plot(i,ylim=c(0,6))
  }
dev.off()

I’m actually not sure whether R does this, or the Linux shell.

Comments are closed.