gpt4 book ai didi

r - 为什么 R 中的这个 visNetwork 不显示边缘

转载 作者:行者123 更新时间:2023-12-01 11:24:56 25 4
gpt4 key购买 nike

我正在探索 visNetwork,无法弄清楚为什么这个不显示边缘

library(visNetwork)
nodes=data.frame(node=c('m1','m2','n1','n2'))
a=data.frame(x=c('n1','n2'),y=c('m1','m2'))
links=a%>% group_by(x,y)%>%tally()
visNetwork(nodes, links)

最佳答案

来自 ?visNetwork:

nodes: data.frame with nodes informations. Needed at least column "id".
edges: data.frame with edges informations. Needed at least columns "from" and "to".

所以

visNetwork(
setNames(nodes, "id"),
setNames(links, c("from", "to", "foo"))
)

会起作用。

关于r - 为什么 R 中的这个 visNetwork 不显示边缘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38169336/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com