R/gen_cutmat.R

#' gen_cutmat function
#'
#' This function creates a matrix of values, where the ith column represents which observations belong in which clusters given you have i clusters.
#'
#' This is one of a few functions created by Joe Cauteruccio, Jessie Li, Andrew West of Yale University that are used together to create the hclust_eval() function.
#' @param clus_out The result of applying hclust() to your data.
#' @param mdim The number of observations in your original data; this is also the maximum number of clusters that can be made with your data.
#'
#'@keywords gen_cutmat
#'@export
gen_cutmat <- function(clus_out, mdim) {
  cut_mat <- matrix(nrow = mdim, ncol = mdim)
  for (i in mdim:1){
    cut_mat[, i] <- cutree(clus_out,k=i)
  }
  return(cut_mat)
}
18kimn/yalestats documentation built on May 9, 2019, 2:17 a.m.