Learn R Programming

move (version 3.2.2)

thinTrackTime: Thinning trajectories to a specific time interval or distance.

Description

These functions thin trajectories, by selecting segments from the original track with a fixed time interval or distance. Finding all segments of a specific time interval might for example be useful for fitting step selection functions.

Usage

thinTrackTime(x, interval = NA, tolerance = NA,
  criteria = c("closest", "first", "all"), ...)
thinDistanceAlongTrack(x, interval = NA, tolerance = NA,
  criteria = c("closest", "first", "all"), ...)

Arguments

x

a move object

interval

in thinTrackTime a object of class difftime specifying a time interval. See 'Examples'. in thinDistanceAlongTrack a numeric value specifying a distance. The units will correspond to the map units. If the coordinates are in long/lat, than the value should be provided in meters.

tolerance

in thinTrackTime a object of class difftime specifying the tolerance of the specified interval. See 'Examples'. in thinDistanceAlongTrack a numeric value specifying the tolerance of the specified interval

criteria

the criteria ("closest", "first" or "all") to be used when multiple solutions are available. Default is "closest".

...

Currently not implemented.

Value

A MoveBurst object, with segments labeled either 'selected' or 'notSelected', only the selected segments match the criteria set in the function call.

A list of MoveBurst objects will all possible solutions if the criteria is set to "all".

Details

The functions search for consecutive segments with a cumulative sum of the time lag (or distance) corresponding to interval and tolerance values. From each selected chunk of the track, only the first and last location are kept in the new object, this new segment is labeled with "selected". The segments labeled as "notSelected" are those parts of the track that did not fulfill the indicated interval. Note that in the case of thinDistanceAlongTrack, the distances between the locations in the new object do not represent the distance that the animal actually traveled, as the intermediate location are removed.

See Also

interpolateTime

Examples

Run this code
# NOT RUN {
data("leroy")
leroysub <- leroy[1:200]
### selecting those segments that have a time interval of 15mins pulsminus 5mins
thintime <- thinTrackTime(leroysub, interval = as.difftime(15, units='mins'),
                          tolerance = as.difftime(5, units='mins'))
summary(timeLag(thintime,"mins")[thintime@burstId=="selected"])

### selecting those segments that have a distance of 100m pulsminus 10m
thindist <- thinDistanceAlongTrack(leroysub, interval = 100, tolerance = 10)
summary(distance(thindist)[thindist@burstId=="selected"])

# }

Run the code above in your browser using DataLab