rsMove (version 0.2.1)

labelSample: labelSample

Description

Region labeling of samples based on their spatial connectivity.

Usage

labelSample(xy = xy, rad = rad, npt = NULL, npx = NULL, pxr = r)

Arguments

xy

Object of class SpatialPoints of SpatialPointsDataFrame.

rad

Minimum radius. Unit depends on the projection of the data.

npt

Minimum pixel count per pixel.

npx

Minimum number of pixels.

pxr

Pixel resolution os a valid raster layer.

Value

A vector.

Details

First, the samples are converted to pixel coordinates and then one of two occur: 1) if npt is set, the function removes pixels with a pixel count smaller than the one specified; 2) If npx is set, the connectivity between neighboring samples is evaluated and regions with a count small than the specified value are filtered. Only one option may be set at a time. Then, the remaining pixels are dilated and the samples are again labeled accounting for regions that are not connected but are near to each other. Regions within a given distance of each other (defined by rad) are aggregated. The grid used for this analysis is built from the spatial extent of xy and a given pixel resolution (pxr). If pxr is a raster, this will be used to define the dimensions of the grid. Doing so can be of use when the user has pre-select environmental predictors that will be used for modeling. Note that the finer the resolution the more independent regions are likely to be returned. The output is a vector with ID's assigning each sample to its region. Samples filtered by npt or npx will be returned as zeros.

See Also

sampleMove hotMove

Examples

Run this code
# NOT RUN {
{
 
 require(raster)
 
 # read raster data
 r <- raster(system.file('extdata', 'tcb_1.tif', package="rsMove"))
 
 # read movement data
 moveData <- read.csv(system.file('extdata', 'konstanz_20130804.csv', package="rsMove"))
 moveData <- SpatialPointsDataFrame(moveData[,1:2], moveData, proj4string=crs(r))
 
 # derive region labels
 labels <- labelSample(xy=moveData, rad=90, npx=2, pxr=30)
 
}
# }

Run the code above in your browser using DataLab