问题
My question is how I might be able to add more arguments to the do.call
function. For example, I want to draw faceted grid
plots with grid.arrange
, how can I add more arguments such as ncol=3
and main="main title"
to the command do.call(grid.arrange,plots)
?
回答1:
consider this list of plots,
library(ggplot2)
library(gridExtra)
pl = replicate(5, qplot(1,1), simplify = FALSE)
you can combine it with a list of options to be passed to do.call
,
do.call(grid.arrange, c(pl, list(ncol=5, main="title")))
来源:https://stackoverflow.com/questions/25962605/how-to-add-more-arguments-of-a-function-in-do-call-in-r