How to combine mutliple calls to a function?

前端 未结 1 813
天涯浪人
天涯浪人 2021-01-27 02:58

I would like to generalize my function calls to be able to pass these calls to a second function as parameters.

In my case I have mutliple ggplots that I store as a list

相关标签:
1条回答
  • 2021-01-27 03:06

    I think this is what you want. It's hard to be sure since I don't use grid stuff often and you didn't provide a reproducible example.

    # Make example data
    p <- qplot(rnorm(30))
    year.plots <- list(p, p, p, p, p, p, p)
    # This will basically construct the call
    # grid.arrange(p, p, p, p, p, p, p, ncol = 3)
    do.call(grid.arrange, c(year.plots, ncol = 3))
    
    0 讨论(0)
提交回复
热议问题