dist2list | R Documentation |
This function takes a distance matrix (of class 'dist') and transforms it to a data.frame, where each row represents a single pairwise comparison.
dist2list(dist, tri = TRUE)
dist |
Distance matrix (object of class 'dist') |
tri |
Logical, if TRUE - only lower triangular part of dist will be returned |
Data frame
The code is based on dist2list
by Jinlong Zhang.
dist2list
from spaa package.
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.