Requires the optional dbscan package. Coordinates are
projected to km via the small-angle latitude factor so eps_km
is interpretable as a kilometre-scale radius.
Usage
morie_tps_dbscan_clusters(
df,
ds_name = "?",
eps_km = 0.25,
min_samples = 30L,
max_n = 30000L,
lat_col = "LAT_WGS84",
lon_col = "LONG_WGS84"
)Value
A named list with the per-cluster table, the count of noise points, and the largest-cluster size.
Examples
if (requireNamespace("dbscan", quietly = TRUE)) {
set.seed(2026)
df <- data.frame(
LAT_WGS84 = c(rnorm(60, 43.65, 0.005), rnorm(60, 43.70, 0.005)),
LONG_WGS84 = c(rnorm(60, -79.40, 0.005), rnorm(60, -79.38, 0.005))
)
morie_tps_dbscan_clusters(df, eps_km = 0.5, min_samples = 5L)
}
#> DBSCAN density clusters -- ?
#> ============================
#> Call: morie_tps_dbscan_clusters(df=<120r>, eps_km=0.5, min_samples=5)
#>
#> Points clustered 120
#> eps (km) 0.5
#> min_samples 5
#> Clusters discovered 2
#> Noise points 5
#> Largest cluster size 58
#>
#> DBSCAN with eps=0.5 km, minPts=5 on 120 point(s) found 2 cluster(s); 5 point(s) classified as noise (no nearby cluster). Largest cluster has 58 member(s).