Description Usage Arguments Details Value Author(s) Examples
n Dimensional Distance Matrix
1 | dist_matr(type_spectra, method = "euclidean")
|
type_spectra |
a dataframe containing node compositions |
method |
character string, the distance measure to be used ("euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski") |
Creates an n dimensional bidirectional distance matrix from a dataframe. If a measure of cultural distance is desired, the data should be structured with a node identifier, followed by the typespectra collums.
symmetrical distance matrix
Oliver Nakoinz <oliver.nakoinz@ufg.uni-kiel.de>
Franziska Faupel <franziska-faupel@gmx.de>
Georg Roth <georg.roth@fu-berlin.de>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | set.seed(1234)
nodes <- data.frame(nodes_x = sample(3433806:3581396, 10, replace = TRUE),
nodes_y = sample(5286004:5484972, 10, replace = TRUE),
nodes_id = c(1:10))
features <- data.frame(x = sample(3433806:3581396, 100, replace = TRUE),
y = sample(5286004:5484972, 100, replace = TRUE),
type = paste0("B", c(rep(1, 5), rep(2,15), sample(11:19, 20, replace = TRUE),
sample(111:119, 30, replace = TRUE), sample(1111:1115, 30, replace = TRUE)))
)
aggr_fea <- aggr_fea_voro(nodes, features, "type")
typelist <- create_type_generator(features, "type", 1)
type_spectra <- create_typespectra(aggr_fea, typelist)
distancematrix <- dist_matr(type_spectra, method = "euclidean")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.