powered by
Fortify a kmeans model with its data
# S3 method for kmeans fortify(model, data = NULL, ...)
The original data with extra columns:
The projected x position.
The projected y position.
The cluster that point belongs to.
kmeans model
kmeans
Data used to fit the model
Not Used
Jared P. Lander
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.
cmdscale
data
kmeans fortify ggplot plot.kmeans
k1 <- kmeans(x=iris[, 1:4], centers=3) hold <- fortify(k1, data=iris) head(hold) hold2 <- fortify(k1) head(hold2)
Run the code above in your browser using DataLab