clusters_km: clustering results of the k-mean algorithm

Description Usage Arguments Value Examples

View source: R/kmeans.R

Description

clusters data into two clusters. This functionis uses the kmeans function to cluster the data and exports the clustering results as well as the sum of square (SS) of clustering using the Euclidian distance.

Usage

1
clusters_km(x, k = 2)

Arguments

x

matrix of data (dim 1: samples (must be equal to dim 1 of X), dim 2: attributes (must be equal to dim 2 of X))

k

number of clusters ( this version considers 2 clusters )

Value

sum of square (SS) of clustring

Examples

1
2
3
4
5
{
X=rbind(matrix(rnorm(1000*2 ,4,.1),1000,2),matrix(rnorm(1000*2, 3, 0.2),1000,2))
M <- X[sample(nrow(X), 2),]
clusters_km(X,2)
}

MajKMeans documentation built on March 31, 2020, 5:17 p.m.