forceNetwork is not zero indexed

后端 未结 1 458
醉话见心
醉话见心 2021-01-19 11:23

I am trying to create a simple forceNetwork, but the plot won\'t render. I keep getting the following warning:

Warning message: It looks like Sou

相关标签:
1条回答
  • 2021-01-19 11:59

    Since networkD3 uses javascript, you need to start your indexing at 0 and not 1 for links. Simply subtract 1 from your nodes/links to reindex:

    links = links-1
    nodes$name = nodes$name-1 #might want to re-index nodes, too
    forceNetwork(Links=links,Nodes = nodes,
                 Source = 'source', Target = 'target', 
                 NodeID = 'name', Group = 'group')
    
    0 讨论(0)
提交回复
热议问题