perform_clustering | R Documentation |
Performs hierarchical clustering on category A based on the binary presence of combinations of categories B and C.
perform_clustering(data, cat_a, cat_b, cat_c)
data |
A data frame containing the variables. |
cat_a |
The name of the column representing category A. |
cat_b |
The name of the column representing category B. |
cat_c |
The name of the column representing category C. |
A vector of category A labels ordered according to the hierarchical clustering.
library(dplyr)
library(tidyr)
library(tibble)
data <- data.frame(
cat_a = rep(letters[1:5], each = 4),
cat_b = rep(LETTERS[1:2], times = 10),
cat_c = sample(c("Var1", "Var2", "Var3"), 20, replace = TRUE)
)
perform_clustering(data, "cat_a", "cat_b", "cat_c")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.