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

why doesn't this visNetwork in R show edge

我正在探索 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"))
) 

会起作用。