Learn R Programming

matR (version 0.9)

distx: Calculate distances with optional grouping and other features

Description

Calculate several distances and dissimilarities with optional grouping, by default columnwise and pairwise, or from an optionally specified common point.

Usage

distx(x, ...)
"distx"(x, method=c("euclidean", "bray-curtis", "jaccard", "mahalanobis", "sorensen", "difference", "maximum", "manhattan", "canberra", "binary", "minkowski"), groups=NULL, p=NULL, ..., bycol=TRUE)
"distx"(x, method="euclidean", groups=NULL, ..., bycol=TRUE)

Arguments

x
a matrix-like object (matrix or biom)
method
name of distance or dissimilarity measure (character)
groups
a grouping of columns/rows (character or factor)
p
a single column/row (numeric)
...
unused
bycol
compute columnwise rather than rowwise? (logical)

Value

Complete technical documentation is forthcoming. For the current preliminary release, please refer to the examples provided.

Details

Complete technical documentation is forthcoming. For the current preliminary release, please refer to the examples provided.

See Also

stats::dist, ecodist::distance

Examples

Run this code
####  Euclidean distance between samples based on raw counts
distx (xx1)

####  alternate dissimilarity measure
distx (xx1, method="bray-curtis")

####  distance in log-transformed data
distx (transform (xx2, t_Log))

####  mean pairwise distance between biomes
distx (xx3, groups="$$biome", method="bray-curtis")

Run the code above in your browser using DataLab