I would like to create 4 plots which show 4 different conditions in a simulation. The 4 conditions in the simulation are iterated using a for loop. What I would like to do is:
for (cond in 1:4){
1.RUN SIMULATION
2.PLOT RESULTS
}
In the end I would like to have 4 plots arranged on a grid. With plot() I can just use par(mfrow) and the plots would be added automatically. Is there a way to do the same with ggplot?
I am aware that I could use grid.arrange() but that would require storing the plots in separate objects, plot1...plot5. But its not possible to do:
for (cond in 1:4){
1. run simulation
2. plot[cond]<-ggplot(...)
}
I cannot give separate names to the plots, like plot1, plot2, plot3 within the loop.

library(gridExtra) ; grid.arrange(p1, p2, p3, p4, ncol=1)