add_clusters {tidybins} | R Documentation |
add_clusters
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
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
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)
[Package tidybins version 0.1.1 Index]