cluster_flows_dbscan | R Documentation |
See dbscan for details on the DBSCAN algorithm.
cluster_flows_dbscan(dist_mat, w_vec, x, eps, minPts)
dist_mat |
distance matrix |
w_vec |
weight vector |
x |
flows tibble with flow_ID |
eps |
DBSCAN epsilon parameter |
minPts |
DBSCAN minPts parameter |
flows tibble with an additional cluster column
flows <- sf::st_transform(flows_leeds, 3857)
flows <- head(flows, 100) # for testing
# Add flow lengths and coordinates
flows <- add_flow_length(flows)
# filter by length
flows <- filter_by_length(flows, length_min = 5000, length_max = 12000)
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")
clustered <- cluster_flows_dbscan(dmat, wvec, flows, eps = 8, minPts = 70)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.