Learn R Programming

rsMove (version 0.1)

hotMove: hotMove

Description

Identifies hotspots of samples using a pixel based approach.

Usage

hotMove(xy = xy, pxr = pxr, shp = FALSE)

Arguments

xy

Object of class SpatialPoints of SpatialPointsDataFrame.

pxr

Grid resolution. Unit depends on xy projection.

shp

Logical. Should the function provide polygons? Default is FALSE.

Value

A list object.

Details

The function builds a matrix for a given resolution and a spatial extent derived from a set of samples (xy). First, these samples are converted into unique pixel coordinates. Then, the spatial connectivity of these pixels is evaluated using a 8-neighboor connected component labelling algorithm. The function returns a vector with the region ID per sample ($indices). If shp is TRUE the function also returns a shapefile for each region defined by the convex hull of the samples within them ($polygons).

See Also

sampleMove hotMoveStats

Examples

Run this code
# NOT RUN {
{

require(rgdal)
require(raster)
require(sp)

# reference data
file <- system.file('extdata', 'latLon_example.shp', package="rsMove")
moveData <- shapefile(file)

# 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)

}
# }

Run the code above in your browser using DataLab