dist2list: Convert distance matrix to data frame

dist2listR Documentation

Convert distance matrix to data frame

Description

This function takes a distance matrix (of class 'dist') and transforms it to a data.frame, where each row represents a single pairwise comparison.

Usage

dist2list(dist, tri = TRUE)

Arguments

dist

Distance matrix (object of class 'dist')

tri

Logical, if TRUE - only lower triangular part of dist will be returned

Value

Data frame

Author(s)

The code is based on dist2list by Jinlong Zhang.

See Also

dist2list from spaa package.

Examples

# Generate dummy data
datt <- dist(rnorm(10))
attr(datt, "Labels") <- paste("obj", 1:10, sep="")

# Convert dist to data frame
head( dist2list(datt)  )
dim( dist2list(datt, tri = T)  ) # only lower-triangular part of dist
dim( dist2list(datt, tri = F)  ) # full distance matrix


vmikk/metagMisc documentation built on June 20, 2024, 7:20 a.m.