add_clusters: add_clusters

Description Usage Arguments Value Examples

View source: R/add_clusters.R

Description

Wraps KMeans_rcpp to create a column that is a cluster formed from select columns in the data frame. Clusters names are specified by capital letters.

Usage

1
add_clusters(.data, ..., n_clusters = 4, cluster_name = "cluster")

Arguments

.data

dataframe

...

columns to cluster (tidyselect)

n_clusters

integer

cluster_name

column name

Value

data frame

Examples

1
2
3
4
5
6
7
8
iris %>%
tibble::as_tibble() %>%
add_clusters(Sepal.Width, Sepal.Length, n_clusters = 3, cluster_name = "Sepal_Cluster") -> iris1

iris1

iris1 %>%
numeric_summary(original_col = Sepal.Width, bucket_col = Sepal_Cluster)

tidybins documentation built on Oct. 14, 2021, 5:22 p.m.