I am trying to print a few groups of 3 plots each in R. In every grouping, 1 plot is a ggplot, and the other 2 are base R plots. The ggplot is successfully plotting each item in the list, but the base R plots are displaying the last item in the list for every output. This is my code
for (i in 1:length(drop_data)){
fit_data(drop_data[i])
print(i)
lay <- rbind(c(1,2),
c(1,3))
resid <- ~plot(residuals[[i]]) + abline(0,0)
qplot <- ~qqnorm(residuals[[i]])
gs <- list(plots[[i]], as_grob(resid), as_grob(qplot))
str(gs)
grid.arrange(grobs = gs, layout_matrix = lay)}
plots is a list of ggplots, and resid and qplot are both lists of base R plots.