Learn R Programming

Tmisc (version 1.0.1)

mat2df: Matrix to pairwise data frame

Description

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

Usage

mat2df(M)

Value

Data frame with pairwise distances.

Arguments

M

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

Examples

Run this code
set.seed(42)
M <- matrix(rnorm(25), nrow=5)
M
mat2df(M)
M <- matrix(rnorm(25), nrow=5, dimnames=list(letters[1:5], letters[1:5]))
M
mat2df(M)
  

Run the code above in your browser using DataLab