rsMove (version 0.2.1)

sampleMove: sampleMove

Description

Sampling of possible stops along a movement track.

Usage

sampleMove(xy = xy, ot = ot, error = error, method = "m",
  tUnit = NULL)

Arguments

xy

Object of class SpatialPoints or SpatialPointsDataFrame.

ot

Object of class Date, POSIXlt or POSIXct with the same length as xy.

error

Distance (in meters).

method

How should the disntance be estimated? One of 'm' or 'deg'. Default is 'm'.

tUnit

Time unit to estimate elapsed time. See difftime for keywords. Default is mins.

Value

A SpatialPointsDataFrame.

Details

This function offers a simple approach to sample from locati where an animal showed little or no movement based on GPS tracking data. It looks at the distance among consecutive samples (error) and estimates mean coordinates for the temporal segments where the animal moved less than the defined distance from the first location of the segment. The user should selected method in accordance with the projection system associated to the data. If 'm' it estimates the ecludian distance. If 'deg' it uses the haversine formula. The output reports on the mean sample coordinates for the sample locations ('x' and 'y'), the start, end and total time spent per sample ('time' expressed in minutes) and the total number of observations per sample ('count').

See Also

labelSample backSample dataQuery

Examples

Run this code
# NOT RUN {
{
 
 require(raster)
 
# reference data
sprj <- crs("+proj=longlat +ellps=WGS84 +no_defs")
moveData <- read.csv(system.file('extdata', 'latlon_example.csv', package="rsMove"))
moveData <- SpatialPointsDataFrame(moveData[,2:3], moveData, proj4string=sprj)

 # sampling without reference grid
 ot = strptime(moveData$timestamp, "%Y-%m-%d %H:%M:%S")
 output <- sampleMove(xy=moveData, ot=ot, error=7, method='deg')
 
 # compare original vs new samples
 plot(moveData, col="black", pch=16)
 points(output$x, output$y, col="red", pch=15)
 
}
# }

Run the code above in your browser using DataLab