如何在R中的do.call中添加函数的更多参数 [英] how to add more arguments of a function in do.call in R
本文介绍了如何在R中的do.call中添加函数的更多参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题是我如何能够向do.call
函数添加更多参数.例如,我想用grid.arrange
绘制多面的grid
图,如何在命令do.call(grid.arrange,plots)
中添加更多的参数,例如ncol=3
和main="main title"
?
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)
?
推荐答案
请考虑以下情节列表,
library(ggplot2)
library(gridExtra)
pl = replicate(5, qplot(1,1), simplify = FALSE)
您可以将其与要传递给do.call
的选项列表结合在一起,
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")))
这篇关于如何在R中的do.call中添加函数的更多参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文