diffDist: Distance Matrix Computation

Description Usage Arguments Details Value Author(s) References Examples

View source: R/diffDist.R

Description

This function computes and returns the distance matrix computed by using the specified distance measure to compute the distances between the rows of a data matrix. Instead of the row values as in the case of dist, the successive differences of the row values are used.

Usage

1
diffDist(x, method = "euclidean", diag = FALSE, upper = FALSE, p = 2)

Arguments

x

a numeric matrix, data frame or "dist" object.

method

the distance measure to be used. This must be one of "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski". Any unambiguous substring can be given.

diag

logical value indicating whether the diagonal of the distance matrix should be printed by print.dist.

upper

logical value indicating whether the upper triangle of the distance matrix should be printed by print.dist.

p

The power of the Minkowski distance.

Details

This function computes and returns the distance matrix computed by using the specified distance measure to compute the distances between the rows of a data matrix. Instead of the row values as in the case of dist, the successive differences of the row values are used.

It's a simple wrapper function arround dist. For more details about the distances we refer to dist.

The function may be helpful, if there is a shift w.r.t.\ the measured bands; e.g.\ c(550, 500, 300, 250) vs.\ c(510, 460, 260, 210).

Value

diffDist returns an object of class "dist"; cf. dist.

Author(s)

Matthias Kohl Matthias.Kohl@stamats.de

References

Flessa, F., Kehl, A., Kohl, M. Analysing diversity and community structures using PCR-RFLP: a new software application. Molecular Ecology Resources 2013 Jul; 13(4):726-33.

Examples

1
2
3
4
5
## assume a shift in the measured bands
M <- rbind(c(550, 500, 300, 250), c(510, 460, 260, 210),
           c(550, 500, 300, 200))
dist(M)
diffDist(M)

Example output

Loading required package: RColorBrewer
   1  2
2 80   
3 50 70
   1  2
2  0   
3 50 50

RFLPtools documentation built on Feb. 8, 2022, 5:06 p.m.