cluster_track that assigns a cluster id to each location in a ctdf by running a
multi-step pipeline:
identify temporally continuous putative regions via
slice_ctdf().merge temporally adjacent putative regions via
spatial_repair().locally cluster each putative region using DTSCAN via
sf_dtscan().enforce non-overlap in time by merging any clusters with overlapping time domains via
temporal_repair().drop small clusters and run additional spatial repairs via
spatial_repair()andtail_repair().optionally merge adjacent clusters within
aggregate_distviaaggregate_ctdf().
Usage
cluster_track(
ctdf,
nmin = 3,
z_min = 1,
trim = 0.05,
minCluster = 3,
deltaT,
aggregate_dist
)Arguments
- ctdf
A
ctdfobject (seeas_ctdf()).- nmin
Integer; passed to
local_cluster_ctdf()(nmin). (clusters withN <= minClusterare dropped before final repairs).- z_min
Numeric; pruning strictness in SD units. Smaller values produce more compact clusters and often more unassigned points. Implementation detail: the underlying thresholds use an inverse z-score convention, so the sign is flipped internally; see
sf_dtscan()andlocal_cluster_ctdf().- trim
Numeric; passed to
temporal_repair(). Maximum fraction trimmed from each- minCluster
Integer; minimum number of points required to keep a putative cluster used when splitting candidate regions into movement segments. tail when estimating each cluster's time domain.
- deltaT
Optional numeric; passed to
slice_ctdf(). Maximum allowable time gap (in days)- aggregate_dist
Optional numeric; if supplied, passed to
aggregate_ctdf()asdist(numeric treated as km).
Details
The function updates ctdf by reference and stores its parameters in
attr(ctdf, "cluster_params").
Examples
data(mini_ruff)
x = as_ctdf(mini_ruff) |> cluster_track()
#> → Find putative cluster regions.
#> ! Spatial repair.
#> → Local clustering.
#> ! Temporal repair.
if (FALSE) { # \dontrun{
data(pesa56511)
pesa = as_ctdf(pesa56511, time = "locationDate") |> cluster_track()
data(ruff143789)
ruff = as_ctdf(ruff143789, time = "locationDate") |> cluster_track()
data(ruff07b5)
ruff2 = as_ctdf(ruff07b5, time = "timestamp") |> cluster_track()
data(lbdo66862)
lbdo2 = as_ctdf(lbdo66862, time = "locationDate") |> cluster_track()
data(nola125a)
nola = as_ctdf(nola125a, time = "timestamp") |> cluster_track()
} # }
