Learn R Programming

rsMove (version 0.2.4)

moveSeg: moveSeg

Description

Pixel based segmentation of movement data using environmental data.

Usage

moveSeg(x, y, z, data.type = "cont", threshold = NULL, summary.fun = NULL,
  buffer.size = NULL, smooth.fun = NULL)

Arguments

x

Object of class RasterLayer or data.frame.

y

Object of class SpatialPoints or SpatialPointsDataFrame.

z

Object of class Date, POSIXlt or POSIXct with y observation dates.

data.type

Raster data data.type. One of cont (continuous) or cat (for categorical).

threshold

Change threshold. Required if data.type is set to cat.

summary.fun

Summary function used to summarize the values within each segment when method is cont. Default is mean.

buffer.size

Spatial buffer size applied around each segment (unit depends on spatial projection).

smooth.fun

Smoothing function applied with buffer.size when method is cont. Default is mean.

Value

A list.

Details

This function identifies segments of comparable environmental conditions along the movement track given by y. Looking at consecutive data points, the function queries x and proceeds to identify a new segment if threshold is exceeded. Then, for each segment, the function summarizes x using summary.fun and reports on the amount of points found within it. Moreover, if z is set, the function reports on the start and end timestamps and the elapsed time. If method is set as 'cont', the function assumes the raster data is a continuous variable. This will require the user to define threshold which indicates when the difference between consecutive points should be considered a change. In order to smooth the extracted values the user can specify buffer.size. This will prompt the function to summarize the values around each sample in y using a metric define bysmooth.fun. However, if data.type is set to cat smooth.fun is ignored. In this case, the function will report on the majority value within the buffer. The output of this function consists of:

  • indices - Vector reporting on the segment identifiers associated to each sample in y.

  • stats - Statistical information for each segment reporting on the corresponding environmental and temporal information.

  • plot - plot of stats showing the variability of environmental conditions and time spent per segment.

See Also

dataQuery imgInt timeDir spaceDir

Examples

Run this code
# NOT RUN {
{

 require(raster)

 # read raster data
 r <- raster(system.file('extdata', 'landCover.tif', package="rsMove"))

 # read movement data
 data(shortMove)

 # observation time
 obs.time <- strptime(paste0(shortMove@data$date, ' ', shortMove@data$time),
 format="%Y/%m/%d %H:%M:%S")

 # perform directional sampling
 seg <- moveSeg(r, shortMove, obs.time, data.type="cat")

}
# }

Run the code above in your browser using DataLab