rsMove (version 0.2.1)

hotMoveStats: hotMoveStats

Description

Provides statistics for the output of hotMove.

Usage

hotMoveStats(rid = NULL, o.time = NULL, tUnit = NULL, aid = NULL,
  method = "deg")

Arguments

rid

List object as provided by hotMove().

o.time

Object of class Date, POSIXlt or POSIXct.

tUnit

Time unit for stats. Default is days. See difftime for additional keywords.

aid

Optional. Unique identifiers.

method

Method used to estimate polygon area.

Value

A data frame.

Details

This functions analysis the attributes of sample regions define by hotMove(). Alternatively, the user can keep rid as NULL. This case, all information will be assumed as part of one region. For each sample region, the function returns the amount of samples (tns. If a vector of unique identifiers is provided (aid) the number of unique identifiers observed within each region is also reported. If temporal information is provided (time) the function identifies unique temporal segment corresponding to periods of consecutive days with observations. For each segment, the function reports on the amount of segments (nts) as well as the minimum (mnt), maximum (mxt) and mean (avt) of the time segments and the total amount of time that they amount to (tts). For each region, the function will also report on the start and end of each temporal segment ($temporal.segments) and will provide the sample indices for associated to each segment ($segment.indices). If rid contains polygons for each region, the function also reports on the area of convex polygons. In this case, the user can use the method keyword to specify how the polygons should be handled. If the polygons are in lat-lon, method deg can be used to re-project each polygon to its corresponding UTZ zone before retrieving the area. This is the default, if the polygons are in a cartesian coordinate system use m.

See Also

hotMove

Examples

Run this code
# NOT RUN {
{

require(raster)

# reference data
sprj <- CRS("+proj=longlat +ellps=WGS84 +no_defs")
moveData <- read.csv(system.file('extdata', 'latlon_example.csv', package="rsMove"))
moveData <- SpatialPointsDataFrame(moveData[,2:3], moveData, proj4string=sprj)

# extract regions
hm <- hotMove(xy=moveData, pxr=0.1, shp=TRUE)

# plot shapefile (color by region)
plot(hm$polygons, col=hm$indices)

# add new information to original shapefile
moveData@data <- cbind(moveData@data, hm$indices)

# derive statistics
hm.region.stats <- hotMoveStats(rid=hm, o.time=as.Date(moveData@data$timestamp))
hm.time.stats <- hotMoveStats(o.time=as.Date(moveData@data$timestamp))

}
# }

Run the code above in your browser using DataLab