Debian Codegraph @

man/tidy.pam.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/cluster.R
3 \name{tidy.pam}
4 \alias{tidy.pam}
5 \alias{pam_tidiers}
6 \title{Tidy a(n) pam object}
7 \usage{
8 \method{tidy}{pam}(x, col.names = paste0("x", 1:ncol(x$medoids)), ...)
9 }
10 \arguments{
11 \item{x}{An \code{pam} object returned from \code{\link[cluster:pam]{cluster::pam()}}}
12
13 \item{col.names}{Column names in the input data frame.
14 Defaults to the names of the variables in x.}
15
16 \item{...}{Additional arguments. Not used. Needed to match generic
17 signature only. \strong{Cautionary note:} Misspelled arguments will be
18 absorbed in \code{...}, where they will be ignored. If the misspelled
19 argument has a default value, the default value will be used.
20 For example, if you pass \code{conf.lvel = 0.9}, all computation will
21 proceed using \code{conf.level = 0.95}. Two exceptions here are:
22 \itemize{
23 \item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if
24 it will be ignored.
25 \item \code{augment()} methods will warn when supplied a \code{newdata} argument if it
26 will be ignored.
27 }}
28 }
29 \description{
30 Tidy summarizes information about the components of a model.
31 A model component might be a single term in a regression, a single
32 hypothesis, a cluster, or a class. Exactly what tidy considers to be a
33 model component varies across models but is usually self-evident.
34 If a model has several distinct types of components, you will need to
35 specify which components to return.
36 }
37 \details{
38 For examples, see the pam vignette.
39 }
40 \examples{
41 \dontshow{if (rlang::is_installed(c("cluster", "modeldata", "ggplot2")) && identical(Sys.getenv("NOT_CRAN"), "true")) withAutoprint(\{ # examplesIf}
42
43 # load libraries for models and data
44 library(dplyr)
45 library(ggplot2)
46 library(cluster)
47 library(modeldata)
48 data(hpc_data)
49
50 x <- hpc_data[, 2:5]
51 p <- pam(x, k = 4)
52
53 # summarize model fit with tidiers + visualization
54 tidy(p)
55 glance(p)
56 augment(p, x)
57
58 augment(p, x) |>
59 ggplot(aes(compounds, input_fields)) +
60 geom_point(aes(color = .cluster)) +
61 geom_text(aes(label = cluster), data = tidy(p), size = 10)
62 \dontshow{\}) # examplesIf}
63 }
64 \seealso{
65 \code{\link[=tidy]{tidy()}}, \code{\link[cluster:pam]{cluster::pam()}}
66
67 Other pam tidiers:
68 \code{\link{augment.pam}()},
69 \code{\link{glance.pam}()}
70 }
71 \concept{pam tidiers}
72 \value{
73 A \code{\link[tibble:tibble]{tibble::tibble()}} with columns:
74 \item{size}{Size of each cluster.}
75 \item{max.diss}{Maximal dissimilarity between the observations in the
76 cluster and that cluster's medoid.}
77 \item{avg.diss}{Average dissimilarity between the observations in the
78 cluster and that cluster's medoid.}
79 \item{diameter}{Diameter of the cluster.}
80 \item{separation}{Separation of the cluster.}
81 \item{avg.width}{Average silhouette width of the cluster.}
82 \item{cluster}{A factor describing the cluster from 1:k.}
83
84 }