3

I'm trying to use a package called d3Network in R to visualize some network and I used the example in R :

# Load data
data(MisLinks)
data(MisNodes)

# Create graph
d3ForceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
               Target = "target", Value = "value", NodeID = "name",
               Group = "group", opacity = 0.4)

It only gives me a bunch of scripts rather than a plot. I saw this example on the internet and it seems the others have never come cross this kind of issue. So am I doing something wrong or something is missing? And also I would like to know how to specify the colour of Source nodes and Target nodes.

Thanks in advance

CJ Yetman
  • 8,373
  • 2
  • 24
  • 56
Lambo
  • 857
  • 3
  • 14
  • 39

1 Answers1

6

It seems you are using d3Network package which is old and not supported anymore. Try using networkD3 package.
The function name is: forceNetwork

Try this:

library(networkD3)
data(MisLinks)
data(MisNodes)
forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
             Target = "target", Value = "value", NodeID = "name",
             Group = "group", opacity = 1)
Suraj
  • 468
  • 1
  • 4
  • 14
  • Yeah I have tried this. It works. The only reason I use 3dNetwork is because there is a argument called zoom. But thanks it is working now. – Lambo Mar 17 '15 at 05:20
  • there is a `zoom` parameter in `networkD3`'s `forceNetwork` function also (at least in the most recent version (v0.4 as of 2017.09.06) – CJ Yetman Sep 06 '17 at 12:56