Skip to content
Prev 314090 / 398506 Next

plotting and saving diagrams automatically

On Dec 22, 2012, at 12:34 PM, eliza botto wrote:

            
The 'pdf' function would allow you to make multi-page objects, arguably more useful than the startegy you are proposing. Or you could use your loop to construct names for 1000 separate jpeg files.

lapply( names(tcp), function(i) filnam <- paste0(i, ".jpg")
                                 jpeg(filnam)
                                  matplot(tcp[[i]][,1],tcp[[i]][,-1], type="l",col="grey")
                                  dev.off()
      )

If you didn't use the names you will not be able to recover them inside the function, since only the object itself is passed.