Render a distance table as a square matrix
Source:R/pairwise_distances_class.R
as.matrix.pairwise_distances.RdMaterialises the wide form, with ids as both row and column names, sorted.
Usage
# S3 method for class 'pairwise_distances'
as.matrix(x, value = PAIRWISE_DISTANCES_VALUE_COL, ...)Details
x must be square (see distances_assert_square, called
here for you): every id present in both id1 and id2. A table
filtered on one id column only is not; use
distances_restrict to filter both.
See also
Other pairwise distances:
[.pairwise_distances(),
distances_assert_square(),
distances_restrict(),
is_pairwise_distances(),
pairwise_distances(),
rvd_dna_specificity,
tales_assign_domain_codes(),
tales_compare_distal(),
tales_compare_functal(),
tales_domain_distances(),
tales_group_hclust(),
tales_group_kmedoids(),
tales_tale_distances(),
validate_pairwise_distances()
Examples
d <- pairwise_distances(data.frame(
id1 = c("A1", "A1", "A2", "A2"),
id2 = c("A1", "A2", "A1", "A2"),
dissim = c(0, 35, 35, 0)
))
as.matrix(d)
#> A1 A2
#> A1 0 35
#> A2 35 0