View source: R/ignition_point.R
ignition_point | R Documentation |
This function calculates ignition points for all clusters.
ignition_point(lon, lat, obsTime, timeUnit, timeID, membership, ignitionCenter)
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". |
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.
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.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.