R/computeLeafColorIdxs.R

computeLeafColorIdxs<-function
### Compute colors of all leafs in dendrogram according to the current
### cluster selection.
##keyword<<internal
(
    df ##<< shared data frame, see 'prepareDendro'
) {
    leafColorIdxs<-rep(0,df$n)
    for (i in seq(along=df$clusters)) {
        if (!is.null(df$clusters[[i]]) && length(df$clusters[[i]]$indices)>0) {
            members<-computeMemberIndices(df$h,max(df$clusters[[i]]$indices))
            leafColorIdxs[members]<-i
        }
    }
    return(leafColorIdxs)
    ### leaf colors
}
tsieger/idendr0 documentation built on June 3, 2021, 3:17 p.m.