print.kMeans: Printing results of k-means clustering

Description Usage Arguments Value See Also Examples

View source: R/print.R

Description

print method for class "kMeans".

Usage

1
2
## S3 method for class 'kMeans'
print(x, ...)

Arguments

x

an object of class "kMeans".

...

further arguments passed to or from other methods.

Value

The method prints the group sizes, the centroids, the cluster allocations and the number of iterations that result from calling kMeansLloyd.

See Also

kMeansLloyd

Examples

1
2
3
4
5
6
7
8
9
# create example data set
X <- rbind(matrix(rnorm(50, sd = 0.5), ncol = 2),
matrix(rnorm(50, mean = 1, sd = 0.5), ncol = 2))

# perform k-means algorithm
result <- kMeansLloyd(x = X, centroids = 2, nStart = 2)

# print result
print(result)

heiligerl/kMeans_Rpackage documentation built on Aug. 16, 2020, 4:04 p.m.