Description Usage Arguments Details Value Author(s) Examples

Calculate an n-by-n matrix by applying a function to all pairs of columns of an m-by-n matrix.

1 | ```
dist2(x, fun, diagonal=0)
``` |

`x` |
A matrix. |

`fun` |
A symmetric function of two arguments that may be columns of |

`diagonal` |
The value to be used for the diagonal elements of the resulting matrix. |

With the default value of `fun`

, this function calculates
for each pair of columns of `x`

the mean of the absolute values
of their differences (which is proportional to the L1-norm of their
difference). This is a distance metric.

The implementation assumes that
`fun(x[,i], x[,j])`

can be evaluated for all pairs of `i`

and `j`

(see examples), and that
`fun`

is symmetric, i.e.
`fun(a, b) = fun(b, a)`

.
`fun(a, a)`

is not actually evaluated, instead the value of `diagonal`

is used to fill the diagonal elements of the returned matrix.

Note that `dist`

computes distances between rows of
`x`

, while this function computes relations between columns of
`x`

(see examples).

A symmetric matrix of size `n x n`

.

Wolfgang Huber, James Reid

1 2 3 4 5 6 7 8 9 |

genefilter documentation built on Oct. 31, 2019, 3:15 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.