Description Usage Arguments Examples
From beginning to end
1 2 | do_cluster(df, vars, to_scale, n_centers = 5,
algorithm = "Hartigan-Wong", trace = FALSE)
|
df |
A dataframe |
vars |
Variables from that dataframe to keep, some of which will be scaled and used for clustering. |
to_scale |
A subset of vars, all numeric, to be scaled and used for clustering. |
n_centers |
The number of clusters you want. |
algorithm |
kmeans algo to use |
trace |
Trace progress? |
1 2 3 4 5 6 7 8 9 10 11 12 13 | v <- names(iris)
t_s <- v[-which(v == "Species" | v == "Petal.Length")]
clustered_iris <- do_cluster(iris, vars = v, to_scale = t_s, n_centers = 3)
## Not run:
ggplot(data = clustered_iris %>%
trim_outliers(exclude = c("cluster_assignment", "Species"))) +
geom_text(aes(Sepal.Width_scaled, Sepal.Length_scaled,
colour = cluster_assignment,
label = Species)) +
theme_bw()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.