[R] Pass additional arguments to do.call(grid.arrange, plots)

Bingzhang Chen bingzhang.chen at gmail.com
Mon Feb 16 01:36:17 CET 2015


Hi R users,

I have a problem on how to pass an extra argument to do. call:

The example codes are:

#--------------------------------------------
require(ggplot2)
plots = lapply(1:5, function(.x) qplot(1:10,rnorm(10), main=paste("plot",.x)))
require(gridExtra)
do.call(grid.arrange,  plots)
#---------------------------------------------

I want to force the composite figures into 2 rows by adding 'now = 2'
in the function 'grid.arrange'. How can I do it?
I searched on google but could not find a workable solution.

I am working on RStudio 0.98.1102 on OSX Yosemite 10.10.2.
Thanks a lot,
Bingzhang

-- 
Bingzhang Chen
Ph. D.,
State Key Lab of Marine Environmental Science,
College of Oceanography and Environmental Science,
Xiamen University,
Xiamen, Fujian 361005
P. R. China



More information about the R-help mailing list