Skip to contents

This function clusters hot spots spatially and temporally.

Usage

global_clustering(lon, lat, timeID, activeTime, adjDist)

Arguments

lon

Numeric. A vector of longitude values.

lat

Numeric. A vector of latitude values.

timeID

Integer (>=1). A vector of time indexes.

activeTime

Numeric (>=0). Time tolerance. Unit is time index.

adjDist

Numeric (>0). Distance tolerance. Unit is metre.

Value

Integer. A vector of membership labels.

Details

For more details about the clustering algorithm and the arguments activeTime and adjDist, please check the documentation of hotspot_cluster(). This function performs the first 3 steps of the clustering algorithm.

Examples


# Define lon, lat and timeID for 10 observations
lon <- c(141.1, 141.14, 141.12, 141.14, 141.16, 141.12, 141.14,
          141.16, 141.12, 141.14)
lat <- c(-37.10, -37.10, -37.12, -37.12, -37.12, -37.14, -37.14,
         -37.14, -37.16, -37.16)
timeID <- c(rep(1, 5), rep(26, 5))

# Cluster 10 hot spots with different values of activeTime and adjDist
global_clustering(lon, lat, timeID, 12, 1500)
#> 
#> ── activeTime = 12 time indexes | adjDist = 1500 meters 
#>  Cluster
#>  10 clusters found (including noise)
#>  [1]  1  2  3  4  5  6  7  8  9 10
global_clustering(lon, lat, timeID, 24, 3000)
#> 
#> ── activeTime = 24 time indexes | adjDist = 3000 meters 
#>  Cluster
#>  2 clusters found (including noise)
#>  [1] 1 1 1 1 1 2 2 2 2 2
global_clustering(lon, lat, timeID, 36, 6000)
#> 
#> ── activeTime = 36 time indexes | adjDist = 6000 meters 
#>  Cluster
#>  1 cluster found (including noise)
#>  [1] 1 1 1 1 1 1 1 1 1 1