Skip to contents

Turns a distance matrix into a data frame of pairwise distances.

Usage

mat2df(M)

Arguments

M

a square pairwise matrix (e.g., of distances).

Value

Data frame with pairwise distances.

Examples

M <- matrix(1:25, nrow=5, dimnames=list(letters[1:5], letters[1:5]))
M
#>   a  b  c  d  e
#> a 1  6 11 16 21
#> b 2  7 12 17 22
#> c 3  8 13 18 23
#> d 4  9 14 19 24
#> e 5 10 15 20 25