ignition_point: Calculation of the ignition points

View source: R/ignition_point.R

ignition_pointR Documentation

Calculation of the ignition points

Description

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".

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.

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.

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")
ignition_point(lon, lat, obsTime, timeUnit, timeID, membership, "median")


TengMCing/hotspotcluster documentation built on Aug. 23, 2023, 12:47 p.m.