twoway_kmeans: Two Way K-Means Clustering with Objective Variable

Description Usage Arguments Details Examples

View source: R/twoway_kmeans.R

Description

Two way k-means with objective variable creates 1 to a chosen "k" k-mean clusters with each centroid featured by a different mean between the x and y variable chosen. twoway_kmeans() allows an easy observation of how the clusters are created, and how the subgroups of the objective variable is assigned to each cluster. If the data does have a specific trend that is subsequently clustered by different means for each groups, the k-means is an accurate tool to allow for observations to choose how many clusters to use, and what each would look like.

Usage

1
twoway_kmeans(xname, yname, kmax, xlabel, ylabel, guidecolor)

Arguments

xname

Chosen x variable's name for k-means.

yname

Chosen y variable's name for k-means.

kmax

Choosing how many k-means clusters to create (numeric value)

xlabel

Name for x axis labels.

ylabel

Name for y axis labels.

guidecolor

Guide title for color of clusters.

Details

twoway_kmeans() returns a ggplot of the k different created k-means clustering, with the utilization of the objective variable's subgroups as labels to see how each subgroup is represented in clusters.

Examples

1
2
3
example <- iris
twoway_kmeans(example$Sepal.Length, example$Petal.Length, 3,
              "Sepal.Length", "Petal.Length", "Cluster by Color")

bhsu4/weightprog documentation built on May 28, 2019, 7:10 p.m.