filter_time: Filter observations for time interval of interest

Description Usage Arguments Value Examples

View source: R/segmentation_helper_functions.R

Description

Selects observations that belong to the time interval of interest and removes all others. This function also removes entire IDs from the dataset when there is one or fewer observations at this time interval. This function works closely with round_track_time to only retain observations sampled at a regular time interval, which is important for analyzing step lengths and turning angles. Column storing the time intervals must be labeled dt.

Usage

1
filter_time(dat.list, int)

Arguments

dat.list

A list of data associated with each animal ID where names of list elements are the ID names.

int

numeric. The time interval of interest.

Value

A list where observations for each animal ID (element) has been filtered for int. Two columns (obs and time1) are added for each list element (ID), which store the original observation number before filtering and the new observation number after filtering, respectively.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#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")

#create list from data frame
tracks.list<- df_to_list(dat = tracks, ind = "id")

#filter observations to only 1 hr (or 3600 s)
tracks_filt.list<- filter_time(dat.list = tracks.list, int = 3600)

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