Skip to contents

This function calculates ignition points for all clusters.

Usage

ignition_point(lon, lat, obsTime, timeUnit, timeID, membership, ignitionCenter)

Arguments

lon

Numeric. A vector of longitude values.

lat

Numeric. A vector of latitude values.

obsTime

Date/Datetime/Numeric. A vector of observed time.

timeUnit

Character. One of "s" (seconds), "m"(minutes), "h"(hours), "d"(days) and "n"(numeric).

timeID

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

membership

Integer. A vector of membership labels.

ignitionCenter

Character. Method of calculating ignition points, one of "mean" and "median".

Value

A data frame of ignition points

  • membership : Membership labels.

  • lon : Longitude of ignition points.

  • lat : Latitude of ignition points.

  • obsTime : Observed time of ignition points.

  • timeID : Time indexes.

  • obsInCluster : Number of observations in the cluster.

  • clusterTimeLen : Length of time of the cluster.

  • clusterTimeLenUnit : Unit of length of time of the cluster.

Details

For more details about the clustering algorithm and the argument timeUnit, timeID and ignitionCenter, please check the documentation of hotspot_cluster(). This function performs the step 5 of the clustering algorithm. It calculates ignition points. For a cluster, when there are multiple earliest hot spots, if ignitionCenter is "mean", the centroid of these hot spots will be used as the ignition point. If ignitionCenter is "median", median longitude and median latitude of these hot spots will be used.

Examples


# Define lon, lat, obsTime, timeID and membership 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)
obsTime <- c(rep(1, 5), rep(26, 5))
timeUnit <- "n"
timeID <- c(rep(1, 5), rep(26, 5))
membership <- c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2)

# Calculate the ignition points using different methods
ignition_point(lon, lat, obsTime, timeUnit, timeID, membership, "mean")
#> 
#> ── ignitionCenter = "mean" 
#>  Compute ignition points for clusters
#>  average hot spots : 5
#>  average duration : 0 numeric
#>   membership     lon     lat obsTime timeID obsInCluster clusterTimeLen
#> 1          1 141.132 -37.112       1      1            5              0
#> 2          2 141.136 -37.148      26     26            5              0
#>   clusterTimeLenUnit
#> 1                  n
#> 2                  n
ignition_point(lon, lat, obsTime, timeUnit, timeID, membership, "median")
#> 
#> ── ignitionCenter = "median" 
#>  Compute ignition points for clusters
#>  average hot spots : 5
#>  average duration : 0 numeric
#>   membership    lon    lat obsTime timeID obsInCluster clusterTimeLen
#> 1          1 141.14 -37.12       1      1            5              0
#> 2          2 141.14 -37.14      26     26            5              0
#>   clusterTimeLenUnit
#> 1                  n
#> 2                  n