By default in R, you can generate a PDF file with multiple pages (1 page: 1 graph) using a single script like so:
single-file-multi-page-PDF-genator.r
library(ggplot2)
# graph for the 1st page
ggplot(...)
# graph for the 2nd page
ggplot(...)
You can also generate a PNG file with a single graph on it
single-file-single-graph-PNG-genator.r
png('/tmp/my-chart.png')
library(ggplot2)
# graph
ggplot(...)
How can you generate multiple PNG graphs by using just a single script in R?