dist.to.df {mFD} | R Documentation |
Merge distance object(s) into a single data frame
Description
This function merges distance object(s) into a single data frame which rows
are pairs of elements and column(s) distance metric(s). It stands on the
dist_long
function.
Usage
dist.to.df(list_dist)
Arguments
list_dist |
a list of dist object(s). All dist objects should have a name (e.g. name of distance metric) and the same labels (i.e. names of sets between which distance was computed). |
Value
A data frame which first and second columns (names x1
and x2
)
contain names of the 2 sets involved in each pair, and with one column for
each dist object (named after its name in list_dist
.
Author(s)
Sebastien Villeger
Examples
# Create dist objects:
dist_A <- round(dist(matrix(runif(10, 0, 1), 5, 2,
dimnames = list(letters[1:5], NULL))), 2)
dist_B <- round(dist(matrix(runif(10, 0, 1), 5, 2,
dimnames = list(letters[1:5], NULL))), 2)
dist_C <- round(dist(matrix(runif(10, 0, 1), 5, 2,
dimnames = list(letters[1:5], NULL))), 2)
# First example with only 1 distance:
dist.to.df(list(dA = dist_A))
# Second example with 3 distances:
dist.to.df(list(d1 = dist_A, d2 = dist_B, d3 = dist_C))
[Package mFD version 1.0.7 Index]