spaceDir: spaceDir

Description Usage Arguments Details Value See Also Examples

View source: R/spaceDir.R

Description

Analysis of environmental change in space along a movement track.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
spaceDir(
  x,
  y,
  sample.direction,
  data.type,
  obs.time = NULL,
  distance.method = "m",
  buffer.size = NULL,
  stat.fun = NULL,
  min.count = 2
)

Arguments

x

Object of class SpatialPoints or SpatialPointsDataFrame.

y

Object of class RasterLayer.

sample.direction

One of forward, backward or both. Default is both.

data.type

One of 'cont' or 'cat'. Defines which type of variable is in use.

obs.time

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

distance.method

One of 'm' or 'deg' specifying the projection unit. Default is 'm'.

buffer.size

Spatial buffer size expressed in the map units.

stat.fun

Output statistical metric.

min.count

Minimum number of pixels required by stat.fun. Default is 2.

Details

This function quantifies environmnetal changes in space along a movement track. For each set of consecutive points, the function will derive coordinates for all unique pixels that overlap with - and are beteween - each point in a spatial moving widow with a shape defined by sample.direction. The user can define buffer.size to consider all pixels within a predefined spatial distance of the initially selected pixels. Once all pixels are selected, the function will extract the corresponding values in y summarize them using a pre-defined statistical function. If data.type is cont, a statistical function can be provided through stat.fun. However, if data.type is cat, the function will report on the dominant class and on the shannon index for each window. If the number of pixels within the a window is lower than min.count the function will return NA. On top of this, spaceDir will also report on the linear distance traveled between endpoints (in meters) and the travel time (in minutes). The output of the function is a list consisting of:

Value

A list containing shapefiles with information on environmental change and travel distance/time and a plot of the results.

See Also

timeDir dataQuery imgInt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{

 require(raster)

 # read raster data
 r <- raster(system.file('extdata', '2013-07-16_ndvi.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
 of <- function(i) {lm(i~c(1:length(i)))$coefficients[2]}
 s.sample <- spaceDir(shortMove, r, "backward", "cont", obs.time=obs.time, stat.fun=of)

}

rsMove documentation built on July 1, 2020, 6:02 p.m.