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