将向量传递给grid.arrange作为参数列表。 [英] Passing a vector to grid.arrange as a list of arguments.
本文介绍了将向量传递给grid.arrange作为参数列表。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我想使用一个向量来概括这个命令,它对我的数据有效。
grid.arrange (Sig1.plot,Sig2.plot,Sig3.plot,Sig4.plot)。
向量是
> Plots.restricted
[1]Sig1.plot,Sig2.plot,Sig3.plot,Sig4.plot
> class(Plots.restricted)
[1]character
p>
grid.arrange(as.name(Plots.restricted),ncol = 1)
返回以下错误
...,as.table = as.table,clip = clip,main = main,:
输入必须是grobs!
或者,我尝试了
Plots.reference< ,ncol(Signatures)-1)),c(2:ncol(Signatures)-1),c(rep )
其中Plots.reference现在生成长度为1的字符向量。
grid.arrange(as.name(Plots.reference))和grid.arrange(as.symbol(Plots.reference))
但仍继续返回错误。
错误?
解决方案您可以尝试:
do.call(grid.arrange,lapply(Plots.restricted,as.name))
$ b b或者:
do.call(grid.arrange,lapply(Plots.restricted,get))
So I'm trying to use a vector to recapitulate this command, which works well on my data
grid.arrange(Sig1.plot,Sig2.plot,Sig3.plot,Sig4.plot).
The vector is
> Plots.restricted [1] "Sig1.plot,Sig2.plot,Sig3.plot,Sig4.plot" > class(Plots.restricted) [1] "character"
However, doing
grid.arrange(as.name(Plots.restricted),ncol=1)
returns the following error
Error in arrangeGrob(..., as.table = as.table, clip = clip, main = main, : input must be grobs!
Alternatively, I tried
Plots.reference<- paste(c(rep("Sig",ncol(Signatures)-1)),c(2:ncol(Signatures)-1),c(rep(".plot",ncol(Signatures)-1)),sep="",collapse=",")
where Plots.reference now produces a character vector of length 1.
grid.arrange(as.name(Plots.reference)) and grid.arrange(as.symbol(Plots.reference))
though continue to return the error.
What am I doing wrong?
解决方案You can try this:
do.call(grid.arrange, lapply(Plots.restricted, as.name))
or alternatively:
do.call(grid.arrange, lapply(Plots.restricted, get))
这篇关于将向量传递给grid.arrange作为参数列表。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文