我的目标是通过列表作为函数geom_point2使用lapply或类似的mapply的参数。在类似的情况下,我必须成功通过列表(或列表)来geom_cladelabel为:将参数传递给geom_point2与地图
mapply(function (x,y,z,w,v,u,t,s) geom_cladelabel(node=x, label=y,
align=F, etc. # Where x y z etc are lists.
问题与内部geom_point2使用aes
。 (不在geom_cladelabel中):
在geom_point2的情况下,节点信息在aes
之内,我不能这样做。通常我不会收到任何错误消息,但它不起作用。
其目的是让这个例子工作,但使用了两次,而不是写geom_point2
的应用程序。
# source("https://bioconductor.org/biocLite.R")
# biocLite("ggtree")
library(ggtree)
library(ape)
#standard code
newstree<-rtree(10)
node1<-getMRCA(newstree,c(1,2))
node2<-getMRCA(newstree,c(3,4))
ggtree(newstree)+
geom_point2(aes(subset=(node ==node1)), fill="black", size=3, shape=23)+
geom_point2(aes(subset=(node ==node2)), fill="green", size=3, shape=23)
#desire to substitute the geom_point2 layers with mapply or lapply:
#lapply(c(node1,node2), function (x) geom_point2(aes(subset=(node=x)))))
如果您提供样本输入数据的[可重现的示例](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example),则更容易为您提供帮助我们可以运行和测试代码。 – MrFlick
getMRCA函数来自哪里? – MrFlick
它是在包猿 – Ferroao