[R] Clusters: How to build a "Amalgamation Schedule" (sequence of jointing )?

womak womak at pochta.ru
Thu Jan 26 00:35:15 CET 2012


Below is the function *hclust*
 hclust
function (d, method = "complete", members = NULL) 
{
    METHODS <- c("ward", "single", "complete", "average", "mcquitty", 
        "median", "centroid")
    method <- pmatch(method, METHODS)
    if (is.na(method)) 
        stop("invalid clustering method")
    if (method == -1) 
        stop("ambiguous clustering method")
    n <- as.integer(attr(d, "Size"))
    if (is.null(n)) 
        stop("invalid dissimilarities")
    if (n < 2) 
        stop("must have n >= 2 objects to cluster")
    len <- as.integer(n * (n - 1)/2)
    if (length(d) != len) 
        (if (length(d) < len) 
            stop
        else warning)("dissimilarities of improper length")
    if (is.null(members)) 
        members <- rep(1, n)
    else if (length(members) != n) 
        stop("invalid length of members")
    hcl <- .Fortran(C_hclust, n = n, len = len, method = as.integer(method), 
        ia = integer(n), ib = integer(n), crit = double(n), members =
as.double(members), 
        nn = integer(n), disnn = double(n), flag = logical(n), 
        diss = as.double(d), PACKAGE = "stats")
    hcass <- .Fortran(C_hcass2, n = as.integer(n), ia = as.integer(hcl$ia), 
        ib = as.integer(hcl$ib), order = integer(n), iia = integer(n), 
        iib = integer(n), PACKAGE = "stats")
    tree <- list(merge = cbind(hcass$iia[1L:(n - 1)], hcass$iib[1L:(n - 
        1)]), height = hcl$crit[1L:(n - 1)], order = hcass$order, 
        labels = attr(d, "Labels"), method = METHODS[method], 
        call = match.call(), dist.method = attr(d, "method"))
    class(tree) <- "hclust"
    tree
}

If a function has no cycles, then, in my view amateur, all the action on the
formation of the cluster tree are made in: 

/*hcl */<- *.Fortran*(C_hclust, n = n, len = len, method =
as.integer(method),  ia = integer(n), ib = integer(n), crit = double(n),
members = as.double(members), nn = integer(n), disnn = double(n), flag =
logical(n), diss = as.double(d), PACKAGE = "stats")
/*hcass */<- *.Fortran*(C_hcass2, n = as.integer(n), ia =
as.integer(hcl$ia), ib = as.integer(hcl$ib), order = integer(n), iia =
integer(n), iib = integer(n), PACKAGE = "stats")

where can I see  some procedures /*C_hclust*/ и */C_hcass2/* or they are
present in the *R* already compiled?  If it possible , then there is hope to
save the merger of clusters in the file and get the "Amalgamation Schedule"
(sequence of jointing).

--
View this message in context: http://r.789695.n4.nabble.com/Clusters-How-to-build-a-Amalgamation-Schedule-sequence-of-jointing-tp4319741p4329061.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list