Difference between revisions of "Cluster.R"

From Organic Design wiki
(Start function)
 
(Function body)
Line 1: Line 1:
clusterPlot <- function(x, ...) {
+
clusterPlot <- function(x, dmethod = "euclidian", hmethod="complete", ...) {
 +
  oldpar <- par(mfrow=c(2,1)) 
 +
  xDist <- dist(x, method=dmethod)
 +
 
 +
# 1) Tree dendrogram
 +
  xClust <- hclust(xDist)
 +
  plclust(xDist)
 +
 
 +
# 2) Image plot... 
  
 +
  par(oldpar)
 +
  invisible()
 
}
 
}

Revision as of 20:43, 11 November 2006

clusterPlot <- function(x, dmethod = "euclidian", hmethod="complete", ...) {

 oldpar <- par(mfrow=c(2,1))  
 xDist <- dist(x, method=dmethod)
 
  1. 1) Tree dendrogram
 xClust <- hclust(xDist)
 plclust(xDist)
 
  1. 2) Image plot...
 par(oldpar)
 invisible()

}