unit.distances {wccsom} | R Documentation |
Function calculates Euclidean distances between units in a SOM; if argument '"toroidal"' is TRUE, the edges of the map are considered to be joined so that the overal shape of the map is a torus. The distances are calculated correspondingly.
unit.distances(grid, toroidal)
grid |
A somgrid object. |
toroidal |
For toroidal maps, equal to TRUE. Default is FALSE. |
Returns a distance matrix.
Ron Wehrens
gr <- somgrid(3, 3, "hexagonal") x <- list(grid = gr) class(x) <- "wccsom" par(mfrow = c(1,2)) unit.dists <- unit.distances(gr, toroidal = FALSE) plot(x, type = "property", property = unit.dists[1,], main = "Distances to unit 1", zlim = c(0,2.75), contin = TRUE) unit.dists <- unit.distances(gr, toroidal = TRUE) plot(x, type = "property", property = unit.dists[1,], main = "Toroidal distances to unit 1", zlim = c(0,2.75), contin = TRUE)