dupfilter: Filter temporal and/or spatial duplicates

View source: R/dupfilter.R

dupfilterR Documentation

Filter temporal and/or spatial duplicates

Description

Function to filter temporal and spatial duplicates in tracking data and retain only a single fix per time and location.

Usage

dupfilter(
  sdata,
  step.time = 0,
  step.dist = 0,
  conditional = FALSE,
  no.cores = 1
)

Arguments

sdata

A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon", "qi". See the data turtle for an example. The function filters the input data by a unique "id" (e.g. transmitter number, identifier for each animal). "DateTime" is the GMT date & time of each location in class POSIXct or character with the following format "2012-06-03 01:33:46". "lat" and "lon" are the latitude and longitude of each location in decimal degrees. "qi" is the quality index associated with each location fix. The input values can be either the number of GPS satellites or Argos Location Classes. Argos Location Classes will be converted to numerical values, where "A", "B", "Z" will be replaced with "-1", "-2", "-3" respectively. The greater number indicates a higher accuracy.

step.time

Consecutive locations less than or equal to step.time apart are considered temporal duplicates. Default is 0 hours.

step.dist

Consecutive locations less than or equal to step.dist apart are considered spatial duplicates. Default is 0 kilometres.

conditional

If TRUE, spatial duplicates are filtered only if they are less than or equal to step.time apart. Default is FALSE.

no.cores

An integer specifying the number of cores used for parallel computing. Alternatively, type in 'detect' to use the maximum number of available cores minus one.

Details

This function filters temporal and spatial duplicates in tracking data. It first filters temporally and spatially exact locations. It then looks for temporal duplicates and retains a fix with the highest quality index. When temporal or spatial duplicates are associated with the same quality index, the function retains a location that is nearest from a previous and to a subsequent location.

Value

The input data frame is returned containing only a single fix (latitude/longitude pair) per time and location. The following columns are added: "pTime", "sTime", "pDist", "sDist". "pTime" and "sTime" are hours from a previous and to a subsequent fix respectively. "pDist" and "sDist" are straight distances in kilometres from a previous and to a subsequent fix respectively.

Author(s)

Takahiro Shimada

References

Shimada T, Limpus C, Jones R, Hazel J, Groom R, Hamann M (2016) Sea turtles return home after intentional displacement from coastal foraging areas. Marine Biology 163:1-14 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s00227-015-2771-0")}

See Also

dupfilter_exact, dupfilter_qi, dupfilter_time, dupfilter_space, track_param

Examples

#### Load data sets
## Fastloc GPS data obtained from a green turtle
data(turtle)


#### Apply dupfilter
turtle.dup <- dupfilter(turtle)

SDLfilter documentation built on Nov. 10, 2023, 1:11 a.m.