weight_vector | R Documentation |
Generate Weight Vector from Flows
weight_vector(dist_mat, x, weight_col = "count")
dist_mat |
distance matrix |
x |
flows tibble with flow_ID and weight_col |
weight_col |
column to use as weights (default = "count") |
numeric weight vector. Each element corresponds to a flow in the distance matrix, and is used as a weight in the DBSCAN clustering algorithm.
flows <- sf::st_transform(flows_leeds, 3857)
flows <- head(flows, 100) # for testing
# Add flow lengths and coordinates
flows <- add_flow_length(flows)
flows <- add_xyuv(flows)
# Calculate distances
distances <- flow_distance(flows, alpha = 1.5, beta = 0.5)
dmat <- distance_matrix(distances)
wvec <- weight_vector(dmat, flows, weight_col = "count")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.