Learn R Programming

sjPlot (version 1.7)

sjc.cluster: Compute hierarchical or kmeans cluster analysis

Description

Compute hierarchical or kmeans cluster analysis and returns the group association for each observation as vector.

Usage

sjc.cluster(data, groupcount, method = "h", distance = "euclidean",
  agglomeration = "ward", iter.max = 20, algorithm = "Hartigan-Wong")

Arguments

Value

The group classification for each observation as vector. This group classification can be used for sjc.grpdisc-function to check the goodness of classification. The returned vector includes missing values, so it can be appended to the original data frame data.

References

Maechler M, Rousseeuw P, Struyf A, Hubert M, Hornik K (2014) cluster: Cluster Analysis Basics and Extensions. R package.

See Also

Examples

Run this code
# Hierarchical clustering of mtcars-dataset
groups <- sjc.cluster(mtcars, 5)

# K-means clustering of mtcars-dataset
groups <- sjc.cluster(mtcars, 5, method="k")

Run the code above in your browser using DataLab