kclustering: K-means cluster analysis

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/kclustering.R

Description

K-means cluster analysis

Usage

1
2
3
4
5
6
7
8
9
kclustering(
  data,
  k = NULL,
  labels = NULL,
  nclumax = 10,
  nruns = 10,
  iter.max = 50,
  algorithm = "Hartigan-Wong"
)

Arguments

data

numeric data frame.

k

integer, number of clusters.

labels

character, row labels.

nclumax

integer, maximum number of clusters (when k=NULL) used for calculating the explained variance as function of the number of clusters.

nruns

integer, run the k-means algorithm nruns times and chooses the best solution according to a maximum explained variance criterion.

iter.max

integer, maximum number of iterations allowed in k-means clustering (see kmeans).

algorithm

character, the algorithm used in k-means clustering (see kmeans).

Details

The kclustering function performs a preliminary standardization of columns in data.

Value

A kclustering object.

If k is NULL, the kclustering object is a list of 3 elements:

If k is not NULL, the kclustering object is a list of 4 elements:

Author(s)

Marco Sandri, Paola Zuccolotto, Marica Manisera (basketballanalyzer.help@unibs.it)

References

P. Zuccolotto and M. Manisera (2020) Basketball Data Science: With Applications in R. CRC Press.

See Also

plot.kclustering, kmeans

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
FF <- fourfactors(Tbox,Obox)
X <- with(FF, data.frame(OD.Rtg=ORtg/DRtg,
               F1.r=F1.Def/F1.Off, F2.r=F2.Off/F2.Def,
               F3.O=F3.Def, F3.D=F3.Off))
X$P3M <- Tbox$P3M
X$STL.r <- Tbox$STL/Obox$STL
kclu1 <- kclustering(X)
plot(kclu1)
kclu2 <- kclustering(X, k=9)
plot(kclu2)

BasketballAnalyzeR documentation built on July 2, 2020, 2:14 a.m.