Examples for 'broom::augment.pam'


Augment data with information from a(n) pam object

Aliases: augment.pam

Keywords:

### ** Examples


# feel free to ignore the following line—it allows {broom} to supply 
# examples without requiring the model-supplying package to be installed.
if (requireNamespace("cluster", quietly = TRUE)) {
  if (requireNamespace("modeldata", quietly = TRUE)) {

# load libraries for models and data
library(dplyr)
library(ggplot2)
library(cluster)
library(modeldata)
data(hpc_data)

x <- hpc_data[, 2:5]
p <- pam(x, k = 4)

# summarize model fit with tidiers + visualization
tidy(p)
glance(p)
augment(p, x)

augment(p, x) %>%
  ggplot(aes(compounds, input_fields)) +
  geom_point(aes(color = .cluster)) +
  geom_text(aes(label = cluster), data = tidy(p), size = 10)

  }
}

[Package broom version 0.8.0 Index]