fortify.kmeans: fortify.kmeans

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

View source: R/kmeansPlotting.r

Description

Fortify a kmeans model with its data

Usage

1
2
## S3 method for class 'kmeans'
fortify(model, data = NULL, ...)

Arguments

model

kmeans model

data

Data used to fit the model

...

Not Used

Details

Prepares a kmeans object to be plotted using cmdscale to compute the projected x/y coordinates. If data is not provided, then just the center points are calculated.

Value

The original data with extra columns:

.x

The projected x position.

.y

The projected y position.

.Cluster

The cluster that point belongs to.

Author(s)

Jared P. Lander

See Also

kmeans fortify ggplot plot.kmeans

Examples

1
2
3
4
5
k1 <- kmeans(x=iris[, 1:4], centers=3)
hold <- fortify(k1, data=iris)
head(hold)
hold2 <- fortify(k1)
head(hold2)

useful documentation built on June 7, 2017, 9:02 a.m.