r2d3 (version 1.0)

D3Sankey: D3 Sankey

Description

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

Usage

D3Sankey(JSON, file_out)

Arguments

JSON
A json object
the
location and name for the output html file

References

Mike Bostock's lovely d3: http://d3js.org/

Examples

Run this code
hc.ave <- hclust(dist(USArrests), "ave")
hc.single <- hclust(dist(USArrests), "single")
hc.ward <- hclust(dist(USArrests), "ward.D")

cut.ave<-cutree(hc.ave, k=6)
cut.single<-cutree(hc.single, k=6)
cut.ward<-cutree(hc.ward, k=6)

ClustComp<-data.frame(States=rownames(USArrests), ave=as.vector(cut.ave),single=as.vector(cut.single),ward=as.vector(cut.ward))

JSON<-jsonCompare(ClustComp)
D3Sankey(JSON, file_out="Sankey.html")

Run the code above in your browser using DataLab