crop_to {tagtools}R Documentation

Reduce the time span of data

Description

This function is used to reduce the time span of data by cropping out any data that falls before and after two time cues.

Usage

crop_to(X, sampling_rate = NULL, tcues, times = NULL)

Arguments

X

A sensor list, vector, or matrix. X can be regularly or irregularly samples data in any frame and unit.

sampling_rate

The sampling rate of X in Hz. This is only needed if X is not a sensor structure.

tcues

A two-element vector containing the start and end time cues in seconds of the data segment to keep (i.e., tcues <- c(start_time, end_time)).

times

A vector of sampling times for X. This is only needed if X is not a sensor list and X is not regularly sampled.

Value

Cropped data in the same format as X, unless X is irregularly sampled and NOT a sensor list. In that case, the function returns a list with 2 elements:

Examples

         d <- find_dives(beaked_whale$P,300) 
         P2 <- crop_to(beaked_whale$P, tcues = c(d$start[1], d$end[1]))	#crop to 1st dive
         plott(X = list(P2), r=c(1), panel_labels=c('Depth'))

[Package tagtools version 0.1.0 Index]