Description Usage Arguments Author(s) References Examples
Creates a html file containing json file and a D3.js Force Directed Layout. If you want colours in the force directed layout to represent a group, please ensure the column is labelled "group" in the data frame
1 2 |
JSON |
A json object |
file_out |
the location and name for the output html file |
arrows |
Boolean do you want arrow heads. By default FALSE |
collision.detect |
Boolean do you want avoid collisions between nodes. By default FALSE |
fisheye |
Boolean do you want fish eye zooming. By default FALSE |
Simon Raper and James Thomson
Mike Bostock's lovely d3: http://d3js.org/
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.