r2d3 (version 1.0)

D3Dendro: D3 Dendrogram

Description

Creates a html file containing json file and a D3.js Dendrogram

Usage

D3Dendro(JSON, file_out, height = 800, width = 700, radial.diameter = 1600, collapsible = FALSE, radial = FALSE)

Arguments

JSON
A json object
file_out
the location and name for the output html file
height
the height of the dendrogram
width
the width of the dendrogram
radial.diameter
The diameter of your radial visualisation. Only needed (and used) when radial=TRUE
collapsible
Logical TRUE/FALSE as to whether you want the visualisation to be collapsible with a single-click on the nodes
radial
Logical TRUE/FALSE as to whether you want the dendrogram to be radial.

References

Mike Bostock's lovely d3: http://d3js.org/ and Captain Anonymous' collapsible radial dendrogram here: http://codepen.io/anon/pen/xItvw

Examples

Run this code
hc <- hclust(dist(USArrests), "ave")
plot(hc)
JSON<-jsonHC(hc)
D3Dendro(JSON,width=400, file_out="USArrests_Dendo.html")
D3Dendro(JSON,collapsible=TRUE,file_out="USArrests_Dendo_collapse.html")
D3Dendro(JSON,collapsible=FALSE,radial=TRUE, file_out="USArrests_Dendo_radial.html")
D3Dendro(JSON,collapsible=TRUE,radial=TRUE,file_out="USArrests_Dendo_collapse_radial.html")

Run the code above in your browser using DataLab