Description Usage Arguments Value Examples
View source: R/segmentation_helper_functions.R
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
.
1 | round_track_time(dat, id, int, tol, time.zone = "UTC", units)
|
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 |
time.zone |
character. Specify the time zone for which the date-times
were recorded. Set to UTC by default. Refer to |
units |
character. The units of the selected time interval |
A data frame where dt
and date
are both adjusted based
upon the rounding of time intervals according to the specified tolerance.
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.