nodes.df<-data.frame(name=c("Dan", "Digby", "Lex", "Flamer", "Stripey"), age=c(32, 38, 45, 17, 2))
links.df<-data.frame(source=c("Dan", "Digby", "Flamer"), target=c("Lex", "Flamer", "Stripey"))
JSON<-jsonNodesLinks(nodes.df, links.df)
D3Force(JSON, file_out="Force.html")
#With directional arrows
D3Force(JSON, file_out="Force.html", arrows=TRUE))
data(celebs)
colnames(celebs$relationships)<-c('source', 'target')
colnames(celebs$celebs)<-c('name', 'group')
JSON<-jsonNodesLinks(celebs$celebs, celebs$relationships)
D3Force(JSON, file_out="/Users/home/Documents/R_Projects/Force.html")
Run the code above in your browser using DataLab