distance2df {pcutils}R Documentation

Convert a distance matrix to a data frame

Description

This function converts a distance matrix into a data frame with three columns: from, to, count. The rows and columns of the matrix are all unique names from the 'from' and 'to' columns,

Usage

distance2df(distance_matrix)

Arguments

distance_matrix

A distance matrix where rows and columns are all unique names from 'from' and 'to' columns.

Value

A data frame containing three columns: from, to, count.

Examples

distance_matrix <- matrix(c(0, 1, 2, 3, 4, 5, 6, 7, 8), nrow = 3)
distance2df(distance_matrix)

[Package pcutils version 0.2.8 Index]