extract_durations is used to return the label that was active for the longest duration. Consider using with the 'evaluate' option in extract_with_timemask.

extract_frequent_label(df, label_col, min_time = -Inf, max_time = Inf)

Arguments

df

Any tibble with columns time and label_col

label_col

Any column in df (character)

min_time

minimum time in s (default -Inf)

max_time

maximum time in s (default Inf)

Value

The most frequent label string (or object) in label_col

Examples

sample <- example_data$head_movement_data_0[[1]]
mask <- extract_timemask(example_data$head_movement_data_0[[1]], pos_x > 1.4)

action_tibble <- example_data$action[[1]]
#> Warning: Unknown or uninitialised column: `action`.
extract_with_timemask(extract_frequent_label, mask, method = "evaluate")(action_tibble, "Coarse")
#> Warning: [extract_with_timemask] Timemask intervals contain only NA values
#> [1] NA