dist_groups: Create a data frame of distances between groups of items.

Description Usage Arguments Value Examples

View source: R/dist.R

Description

Create a data frame of distances between groups of items.

Usage

1

Arguments

d

A distance matrix object of class dist.

g

A factor representing the groups of objects in d.

Value

A data frame with 6 columns:

Item1, Item2

The items being compared.

Group1, Group2

The groups to which the items belong.

Label

A convenient label for plotting or comparison.

Distance

The distance between Item1 and Item2.

Examples

1
2
3
4
m4 <- matrix(1:16, nrow=4, dimnames=list(LETTERS[1:4]))
dm4 <- dist(m4)
g4 <- rep(c("Control", "Treatment"), each=2)
dist_groups(dm4, g4)

Example output

  Item1 Item2    Group1    Group2                         Label Distance
1     A     B   Control   Control                Within Control        2
2     A     C   Control Treatment Between Control and Treatment        4
3     A     D   Control Treatment Between Control and Treatment        6
4     B     C   Control Treatment Between Control and Treatment        2
5     B     D   Control Treatment Between Control and Treatment        4
6     C     D Treatment Treatment              Within Treatment        2

usedist documentation built on March 2, 2020, 1:07 a.m.