This function aligns movement data to a uniform time scale with a uniform temporal resolution throughout the complete movement sequence. This prepares the provided movement data to be interpretable by frames_spatial, which necessitates a uniform time scale and a consistent, unique temporal resolution for all moving individuals to turn recording times into frame times.

align_move(m, res = "min", digit = "min", unit = "secs",
  spaceMethod = "greatcircle")

Arguments

m

move or moveStack, which is allowed to contain irregular timestamps and diverging temporal resolutions to be aligned (see df2move to convert a data.frame to a move object).

res

either numeric, representing the temporal resolution, to which m should be aligned to (see argument unit), or character:

  • "min" to use the smalles temporal resolution of m (default)

  • "max" to use the largest temporal resolution of m

  • "mean" to use the rounded average temporal resolution of m

digit

either numeric, indicating to which digits of a specifc unit (see argument unit) the time scale of m should be aligned (e.g. 0 to align the time scale to second ":00", if unit is set to secs), or character:

  • "min" to use the smallest digit of the defined unit (default)

  • "max" to use the largest digit of the defined unit

  • "mean" to use the rounded average digit of the defined unit

unit

character, either "secs", "mins", "hours", "days", indicating the temporal unit, to which res and digit are referring.

spaceMethod

character, either "euclidean", "greatcircle" or "rhumbline", indicating the interpolation function to be used to interpolate locations of m to the aligned time scale. Interpolation is performed using move::interpolateTime.

Value

Aligned move or moveStack, ready to be used with frames_spatial-

See also

Examples

# NOT RUN {
library(moveVis)
library(move)
data("move_data")

# the tracks in move_data have irregular timestamps and sampling rates.
# print unique timestamps and timeLag
unique(timestamps(move_data))
unique(unlist(timeLag(move_data, units = "secs")))

# use align_move to correct move_data to a uniform time scale and lag using interpolation.
# resolution of 4 minutes (240 seconds) at digit 0 (:00 seconds) per timestamp:
m <- align_move(move_data, res = 240, digit = 0, unit = "secs")
unique(unlist(timeLag(m, units = "secs")))

# resolution of 1 hour (3600 seconds) at digit 0 (:00 seconds) per timestamp:
m <- align_move(move_data, res = 3600, digit = 0, unit = "secs")
unique(unlist(timeLag(m, units = "secs")))

# resolution of 1 hour (15 seconds) at digit 0 (:00 seconds) per timestamp:
m <- align_move(move_data, res = 15, digit = 0, unit = "secs")
unique(unlist(timeLag(m, units = "secs")))

# resolution of 1 hour:
m <- align_move(move_data, res = 60, unit = "mins")
unique(unlist(timeLag(m, units = "secs")))

# }