Learn R Programming

rsMove (version 0.2.3)

moveSeg: moveSeg

Description

Pixel based segmentation of movement data using environmental data.

Usage

moveSeg(xy = xy, env.data = env.data, data.type = "cont",
  threshold = threshold, obs.time = NULL, summary.fun = NULL,
  buffer.size = NULL, smooth.fun = NULL)

Arguments

xy

Object of class SpatialPoints or SpatialPointsDataFrame.

env.data

Object of class RasterLayer or data.frame.

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.

obs.time

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

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 xy. Looking at consecutive data points, the function queries env.data and proceeds to identify a new segment if threshold is exceeded. Then, for each segment, the function summarizes env.data using summary.fun and reports on the amount of points found within it. Moreover, if obs.time 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 xy 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 xy.

  • 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(xy=shortMove, obs.time=obs.time, env.data=r, data.type="cat")

}
# }

Run the code above in your browser using DataLab