Tidy summarizes information about the components of a model. A model component might be a single term in a regression, a single hypothesis, a cluster, or a class. Exactly what tidy considers to be a model component varies cross models but is usually self-evident. If a model has several distinct types of components, you will need to specify which components to return.
# S3 method for dist tidy(x, diagonal = attr(x, "Diag"), upper = attr(x, "Upper"), ...)
x | A |
---|---|
diagonal | Logical indicating whether or not to tidy the diagonal
elements of the distance matrix. Defaults to whatever was based to the
|
upper | Logical indicating whether or not to tidy the upper half of
the distance matrix. Defaults to whatever was based to the
|
... | Additional arguments. Not used. Needed to match generic
signature only. Cautionary note: Misspelled arguments will be
absorbed in |
A tibble::tibble with one row for each pair of items in the distance matrix, with columns:
First item
Second item
Distance between items
If the distance matrix does not include an upper triangle and/or diagonal, the tidied version will not either.
Other stats tidiers: tidy.density
,
tidy.ftable
#> Sepal.Length Sepal.Width Petal.Length #> Sepal.Width 36.15785 #> Petal.Length 28.96619 25.77809 #> Petal.Width 57.18304 25.86407 33.86473tidy(iris_dist)#> # A tibble: 6 x 3 #> item1 item2 distance #> <fct> <fct> <dbl> #> 1 Sepal.Width Sepal.Length 36.2 #> 2 Petal.Length Sepal.Length 29.0 #> 3 Petal.Width Sepal.Length 57.2 #> 4 Petal.Length Sepal.Width 25.8 #> 5 Petal.Width Sepal.Width 25.9 #> 6 Petal.Width Petal.Length 33.9#> # A tibble: 12 x 3 #> item1 item2 distance #> <fct> <fct> <dbl> #> 1 Sepal.Width Sepal.Length 36.2 #> 2 Petal.Length Sepal.Length 29.0 #> 3 Petal.Width Sepal.Length 57.2 #> 4 Sepal.Length Sepal.Width 36.2 #> 5 Petal.Length Sepal.Width 25.8 #> 6 Petal.Width Sepal.Width 25.9 #> 7 Sepal.Length Petal.Length 29.0 #> 8 Sepal.Width Petal.Length 25.8 #> 9 Petal.Width Petal.Length 33.9 #> 10 Sepal.Length Petal.Width 57.2 #> 11 Sepal.Width Petal.Width 25.9 #> 12 Petal.Length Petal.Width 33.9#> # A tibble: 10 x 3 #> item1 item2 distance #> <fct> <fct> <dbl> #> 1 Sepal.Length Sepal.Length 0 #> 2 Sepal.Width Sepal.Length 36.2 #> 3 Petal.Length Sepal.Length 29.0 #> 4 Petal.Width Sepal.Length 57.2 #> 5 Sepal.Width Sepal.Width 0 #> 6 Petal.Length Sepal.Width 25.8 #> 7 Petal.Width Sepal.Width 25.9 #> 8 Petal.Length Petal.Length 0 #> 9 Petal.Width Petal.Length 33.9 #> 10 Petal.Width Petal.Width 0