pw_mat_to_df: Convert a pairwise matrix into an edge-list data.frame

Description Usage Arguments Value Author(s) Examples

View source: R/pw_mat_to_df.R

Description

The function converts a pairwise matrix into an edge-list data.frame

Usage

1
pw_mat_to_df(pw_mat)

Arguments

pw_mat

A pairwise matrix which can be:

  • An object of class matrix. It must have the same row names and column names. If values represent distances, diagonal elements should be equal to 0.

  • An object of class dist. In that, its column numbers are used to create IDs in the resulting data.frame.

Value

An object of class data.frame

Author(s)

P. Savary

Examples

1
2
3
data(data_tuto)
pw_mat <- data_tuto[[1]]
df <- pw_mat_to_df(pw_mat)

graph4lg documentation built on March 16, 2021, 5:09 p.m.