R/run_hclust.R

Defines functions run_hclust

Documented in run_hclust

#' A wrapper function to run hierarchical clustering
#' 
#' @param x Data frame to run hierarchical clustering
#' @param method Specify method for hierarchical clustering. See ?hclust for details
#' @param dmeth Specify method for calculating distance. See ?dist for details
#' @examples 
#' library(magrittr)
#' library(dplyr)
#' iris %>% select(-Species) %>% run_hclust()
#' @export
run_hclust <- function(x, method = "complete", dmeth = "euclidean") {    
  hclust(dist(x, method = dmeth), method = method)
}
martinctc/surveytools documentation built on Nov. 21, 2024, 10:48 p.m.