R/myclus.r

Defines functions myclus

Documented in myclus

# From Venables and Ripley 
myclus<-function(data = swiss,k = 3){
hc <- hclust(dist(data), "ave")
 memb <- cutree(hc, k)
 cent <- NULL
for(i in 1:k){
   cent <- rbind(cent, apply(data[memb==i,,drop=FALSE], 2, mean))
 }
return(kmeans(data,cent))
}

Try the SAGx package in your browser

Any scripts or data that you put into this service are public.

SAGx documentation built on Nov. 8, 2020, 8:18 p.m.