I am trying to plot a network using the d3Network package. I tried to organize the data according to the instructions that appear on the website (and the help page), but I still get a blank web page. Can anyone determine what I am doing wrong?
library(d3Network) g.top3000 <- structure(list(from = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 5L), .Label = c("afghanistan", "attack", "people", "pres_bush", "taliban"), class = "factor"), to = structure(c(4L, 1L, 5L, 2L, 3L, 1L, 5L, 2L, 3L, 5L, 2L, 3L, 2L, 3L, 3L), .Label = c("people", "taliban", "united_states", "attack", "pres_bush"), class = "factor"), weight = c(4, 3, 2, 6, 5, 5, 2, 3, 6, 1, 1, 5, 2, 4, 4)), .Names = c("from", "to", "weight"), row.names = c(NA, -15L), class = "data.frame") top3000.nodes <- structure(list(name = structure(1:5, .Label = c("afghanistan", "attack", "people", "pres_bush", "taliban"), class = "factor"), id = c(1, 1, 1, 2, 2)), .Names = c("name", "id"), row.names = c(NA, -5L), class = "data.frame") d3ForceNetwork(Links = g.top3000, Nodes = top3000.nodes, Source = "from", Target = "to", Value = "weight", NodeID = "name", Group = "id", width = 800, height = 400, opacity = 0.9, file = "projekt2_terror_news_force.html")
Building a simple graph works just fine
d3SimpleNetwork(g.top3000, width = 800, height = 400, fontsize = 12, linkDistance = 200, file = "projekt2_terror_news.html")