I want to be able to "walk" (iterate) through a hierarchical cluster (see the figure below and the code). I want to:
A function that takes a matrix and a minimum height. Let's say 10 in this example.
splitme <- function(matrix, minH){
Starting from the top to minH , start cutting whenever a new split appears. This is the first problem. How to detect new splits to get a height h .
In this particular h , how many clusters are there? Eject clusters
mycl <- cutree(hr, h=x);
Store each of the new matrices in the variable (s). This is another difficult task - dynamically creating x new matrices. Thus, it is possible that a function that accepts clusters does what needs to be done (comparisons) and returns a variable
Continue 3 and 4 until minH reaches
Picture

Code
# Generate data set.seed(12345) desc.1 <- c(rnorm(10, 0, 1), rnorm(20, 10, 4)) desc.2 <- c(rnorm(5, 20, .5), rnorm(5, 5, 1.5), rnorm(20, 10, 2)) desc.3 <- c(rnorm(10, 3, .1), rnorm(15, 6, .2), rnorm(5, 5, .3)) data <- cbind(desc.1, desc.2, desc.3)
source share