0
我正在使用gRbase软件包中的“dag”函数与plot结合创建一些DAG。R - 列表作为函数中的输入参数
在 “DAG” 帮助页面我看到这在参数:
X,A含有生成类的曲线图列表,请参见实施例 下面
在以下实施例我看到这样的事情:
dagr <- dag(c("me","ve"),c("me","al"),c("ve","al"),c("al","an"),c("al","st"),c("an","st"))
啥都当我执行这个代码,它的工作原理,并给我的图:
> plot(dag(c("A", "B"), c("B", "C")))
为什么当我创建自己的列表时,出现以下错误?
> mylist <- list();
> mylist[1] <- list(c("A", "B"))
> mylist[2] <- list(c("B", "C"))
> mylist
[[1]]
[1] "A" "B"
[[2]]
[1] "B" "C"
> plot(dag(mylist))
Error in plot(dag(mylist)) :
error in evaluating the argument 'x' in selecting a method for function 'plot': Error in .ftM2other(ft, W, V, edgemode, "graphNEL") :
Node names in 'ft' must be contained in 'V'.
谢谢!这工作。 与此同时,我通过直接针对ftM2graphNEL函数使用Nx2矩阵来解决此问题。 – 2012-03-29 15:47:49