add_lena_stats: Add LENA stats to each interval in a dataframe

View source: R/lena.R

add_lena_statsR Documentation

Add LENA stats to each interval in a dataframe

Description

Add LENA stats to each interval in a dataframe

Usage

add_lena_stats(its_xml, intervals, time_type = c("wav", "wall"))

Arguments

its_xml

XML object created by rlena::read_its_file.

intervals

A tibble with columns interval_start, interval_end, interval_start_wav, and recording_id as output by prepare_intervals. Can contain other columns.

time_type

Either wall or wav. If wall, start and end must contain timestamps with local time. If wav, start and end must contain the number of milliseconds since the beginning of the wav file. wall is not yet implemented.

Value

Same as intervals but with three new columns: cvc, ctc, and awc.

Note

Any its segment overlapping with multiple intervals will count fully towards all of them.

The difference between this function and calculate_lena_like_stats is that the latter calculates exactly the same stats but does it for every five minute period of wall time (e.g., 13:00-13:05). It should be rewritten to first create these intervals and then use add_lena_stats to avoid code repetition (see issue #).


BergelsonLab/blabr documentation built on April 19, 2024, 7:21 p.m.