Created
August 16, 2014 11:08
-
-
Save jamesthomson/176e0a24c5496b2e99b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data(counties) | |
JSON<-jsonNestedData(structure=counties[,1:3], values=counties[,4], top_label="UK") | |
D3Tree(JSON, file_out="Tree.html") | |
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="/Users/home/Documents/R_Projects/Sankey.html") | |
hc <- hclust(dist(USArrests), "ave") | |
plot(hc) | |
JSON<-jsonHC(hc) | |
D3Dendro(JSON, file_out="/Users/home/Documents/R_Projects/USArrests_Dendo.html") | |
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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment