How to iteratively build and export multiple graphs from 1 data set based on a factor
Here is a small example of how it could be done using for loops with the mtcars dataset for(g in unique(mtcars$gear)) { f <- filter(mtcars, gear == g) p <- ggplot(f, aes(disp, hp)) + geom_point() ggsave(paste0(‘plot_’, g,’.jpg’), p) } In your case it would something like this for(s in unique(WQ_byStation$StationName)){ f <- filter(WQ_byStation, StationName == … Read more