Description Usage Arguments Value See Also Examples

View source: R/object.distances.R

This function calculates the distance between objects using the distance functions,
weights and other attributes of a trained SOM. This function is used in the calculation of the U matrix in
function `plot.missSOM`

using the `type = "dist.neighbours" argument.`

1 | ```
object.distances(kohobj, type = c("data", "ximp", "codes"))
``` |

`kohobj` |
An object of class |

`type` |
Whether to calculate distances between the data objects, or the codebook vectors. |

An object of class `dist`

, which can be directly fed into (e.g.) a hierarchical clustering.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
data(wines)
## Data with no missing values
set.seed(7)
sommap <- imputeSOM(scale(wines), grid = somgrid(6, 4, "hexagonal"))
obj.dists <- object.distances(sommap, type = "data")
code.dists <- object.distances(sommap, type = "codes")
## Data with missing values
X <- scale(wines)
X[1:5, 1] <- NaN
sommap <- imputeSOM(X, grid = somgrid(6, 4, "hexagonal"))
obj.dists <- object.distances(sommap, type = "ximp")
code.dists <- object.distances(sommap, type = "codes")
``` |

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.