Skip to contents

Checks the column contract, and nothing else. Squareness, the diagonal and symmetry are preconditions of the methods that need them, checked by distances_assert_square: a table filtered on one id column is a legitimate intermediate step.

Usage

validate_pairwise_distances(x)

Arguments

x

A pairwise_distances object.

Value

x, invisibly, if valid; otherwise an error.

Examples

d <- data.frame(
  id1 = c("A1", "A1", "A2", "A2"),
  id2 = c("A1", "A2", "A1", "A2"),
  dissim = c(0, 35, 35, 0)
)
validate_pairwise_distances(pairwise_distances(d))

# Without its dissim column, a table is not a pairwise_distances
try(validate_pairwise_distances(d[, c("id1", "id2")]))
#> Error in validate_pairwise_distances(d[, c("id1", "id2")]) : 
#>   A <pairwise_distances> object requires the column dissim.