Let's say I have a list of stories that I created.
library(ggplot2) plots <- list() plots$a <- ggplot(cars, aes(speed, dist)) + geom_point() plots$b <- ggplot(cars, aes(speed)) + geom_histogram() plots$c <- ggplot(cars, aes(dist)) + geom_histogram()
Now I would like to save all this data, marked by each of them with their corresponding names (graphs).
lapply(plots, function(x) { ggsave(filename=paste(...,".jpeg",sep=""), plot=x) dev.off() } )
What would I replace "..." so that in my working directory the graphs are saved as:
a.jpeg b.jpeg c.jpeg
r ggplot2
Brandon bertelsen
source share