round_track_time: Round time to nearest interval

Description Usage Arguments Value Examples

View source: R/segmentation_helper_functions.R

Description

Rounds sampling intervals that are close, but not exactly the time interval of interest (e.g., 240 s instead of 300 s). This can be performed on multiple time intervals, but only using a single tolerance value. This function prepares the data to be analyzed by segment_behavior, which requires that all time intervals exactly match the primary time interval when analyzing step lengths and turning angles. Columns storing the time intervals and dates must be labeled dt and date, respectively, where dates are of class POSIXct.

Usage

1
round_track_time(dat, id, int, tol, time.zone = "UTC", units)

Arguments

dat

A data frame that contains the sampling interval of the observations.

id

character. The name of the column storing the animal IDs.

int

numeric. A vector of the time interval(s) of on which to perform rounding.

tol

numeric. A single tolerance value on which to round any int that were specified.

time.zone

character. Specify the time zone for which the date-times were recorded. Set to UTC by default. Refer to base::OlsonNames to view all possible time zones.

units

character. The units of the selected time interval int, which can be selected from one of "secs", "mins", "hours", "days", or "weeks".

Value

A data frame where dt and date are both adjusted based upon the rounding of time intervals according to the specified tolerance.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#load data
data(tracks)

#subset only first track
tracks<- tracks[tracks$id == "id1",]

#calculate step lengths and turning angles
tracks<- prep_data(dat = tracks, coord.names = c("x","y"), id = "id")

#round times to nearest interval of interest (e.g. 3600 s or 1 hr)
tracks<- round_track_time(dat = tracks, id = "id", int = 3600, tol = 180, time.zone = "UTC",
                          units = "secs")

bayesmove documentation built on Oct. 22, 2021, 9:08 a.m.