get_pairwise_distance: Make a table of pairwise distances based on group membership.

View source: R/dist_to_df.R

get_pairwise_distanceR Documentation

Make a table of pairwise distances based on group membership.

Description

Given a dist object, extract the relevant pairwise distances. .

Usage

get_pairwise_distance(x, metadata, g = NULL, simplify_output = TRUE)

Arguments

x

a dist object, denoting the pairwise distances between samples.

metadata

a vector or table. If a table is given, g cannot be left at NULL. In this case, all additional information in the metadata file is preserved in the returned data.frame.

g

Defaults to NULL. If metadata is a table, g should denote the name or index of the column that contains the grouping variable.

simplify_output

Defaults to TRUE. Whether duplicate columns should be removed from the returned data.frame.

Value

a data.frame with at least four columns: "to", "from", "dist" and "group". As well as any additional information provided with metadata argument.

Examples

c.exp <- clr_lite(vola_genus_table)
c.dist <- dist(t(c.exp))

get_pairwise_distance(x = c.dist, metadata = vola_metadata, g = "ID")


thomazbastiaanssen/Volatility documentation built on July 13, 2024, 9:09 a.m.