cluster: Groups Clusters

Description Usage Arguments Value Examples

View source: R/cluster.R

Description

cluster function will draw Clusters for Groups analysis.

Usage

1
cluster(data, x, y, class, title = NULL, subtitle = NULL, caption = NULL)

Arguments

data

input data.frame

x

x variable

y

y variable

class

class variable

title

main title

subtitle

subtitle

caption

caption

Value

An object of class ggplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Compute data with principal components
df <- iris[c(1, 2, 3, 4)]
pca_mod <- prcomp(df)  # compute principal components

# Data frame of principal components
df_pc <- data.frame(pca_mod$x, Species=iris$Species)  # dataframe of principal components
plot<- cluster(data=df_pc,x="PC1",y="PC2",class="Species",
               title="Iris Clustering",
               subtitle="With principal components PC1 and PC2 as X and Y axis",
               caption="Source: Iris")
plot

HeeseokMoon/ggedachart documentation built on Dec. 31, 2020, 12:59 p.m.