mt_filter_per_interval {move2}R Documentation

Find subset of records based on time windows

Description

Usage

mt_filter_per_interval(x, ...)

mt_per_interval(
  x,
  criterion = c("first", "random", "last"),
  unit = "hour",
  ...
)

Arguments

x

a move2 object

...

additional arguments to mt_per_interval and floor_date, for example the day that starts the week

criterion

the criterion of what record to select per time interval

unit

the time units to select the first record per. This can also be a multiple of units (e.g. "30 seconds"). For more details see floor_date

Details

The function selects one event per defined interval (time window). The time lag between the selected events does not necessarily correspond to the defined interval. For example, if the defined time interval is "1 hour" with the criterion "first", the function will select the event that is closest to every full hour, so if the first event of a track is at 10:45 and the second at 11:05, both of them will be selected, as they fall into different hour windows, but the time lag between them is 20 minutes. When sampling down a track, the time lags mostly correspond to the defined time interval, except the first time lag, and when there are gaps in the data.

Value

mt_per_interval returns a logical vector indicating the selected records.
mt_filter_per_interval returns a filtered move2 object

See Also

Other filter: mt_filter_movebank_visible(), mt_filter_unique()

Examples

data <- mt_sim_brownian_motion(as.POSIXct("2022-1-1") + 1:10)
data |> mt_filter_per_interval(criterion = "random")
data |> mt_filter_per_interval(unit = "3 secs")
data[mt_per_interval(data, unit = "6 secs"), ]

[Package move2 version 0.3.0 Index]