dist_long: Turns a dist object to a "long" table

Description Usage Arguments Value Examples

View source: R/dist_long.R

Description

Turns a dist object from a "wide" to a "long" table

Usage

1

Arguments

d

a distance object

...

not used

Value

A data.frame with two columns of rows and column names of the dist object and a third column (distance) with the distance between the two.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(iris)
iris[2:6, -5] %>%
  dist() %>%
  data.matrix()
iris[2:6, -5] %>%
  dist() %>%
  as.vector()
iris[2:6, -5] %>%
  dist() %>%
  dist_long()
# This can later be used to making a network plot based on the distances.

Example output

---------------------
Welcome to dendextend version 1.14.0
Type citation('dendextend') for how to cite the package.

Type browseVignettes(package = 'dendextend') for the package vignette.
The github page is: https://github.com/talgalili/dendextend/

Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
Or contact: <tal.galili@gmail.com>

	To suppress this message use:  suppressPackageStartupMessages(library(dendextend))
---------------------


Attaching package:dendextendThe following object is masked frompackage:stats:

    cutree

          2        3         4         5         6
2 0.0000000 0.300000 0.3316625 0.6082763 1.0908712
3 0.3000000 0.000000 0.2449490 0.5099020 1.0862780
4 0.3316625 0.244949 0.0000000 0.6480741 1.1661904
5 0.6082763 0.509902 0.6480741 0.0000000 0.6164414
6 1.0908712 1.086278 1.1661904 0.6164414 0.0000000
 [1] 0.3000000 0.3316625 0.6082763 1.0908712 0.2449490 0.5099020 1.0862780
 [8] 0.6480741 1.1661904 0.6164414
   rows cols  distance
2     3    2 0.3000000
3     4    2 0.3316625
4     5    2 0.6082763
5     6    2 1.0908712
8     4    3 0.2449490
9     5    3 0.5099020
10    6    3 1.0862780
14    5    4 0.6480741
15    6    4 1.1661904
20    6    5 0.6164414

dendextend documentation built on May 9, 2021, 1:06 a.m.