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

View source: R/pw_mat_to_df.R

pw_mat_to_dfR Documentation

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

Description

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

Usage

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

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

graph4lg documentation built on Feb. 16, 2023, 5:43 p.m.