I feel I\'m always asking a variation of the same question :(
I recently got a list of plots + table to display on grid.arrange using the do.call function
You could use mget
like this:
plist2 <- mget(paste0("g", 1:4))
do.call(grid.arrange, plist2)
But it would be better to put the plots into a list when creating them, like this:
funs <- c(sin, tan, cos)
DF <- data.frame(x=c(0, 10))
g <- lapply(funs, function(fun, df) {
ggplot(df, aes(x)) + stat_function(fun=fun)
}, df=DF)
#g[[4]] <- tableGrob(data.frame(x = 1:10, y = 2:11, z = 3:12))
#better for programmatic use:
g <- c(g, list(tableGrob(data.frame(x = 1:10, y = 2:11, z = 3:12))))
do.call(grid.arrange, g)