Skip to contents

Quantify bouts of temperature above or below a threshold

Usage

quantify_temp_bouts(
  df,
  direction = "below",
  threshold,
  greedy = FALSE,
  max_gap = 10
)

Arguments

df

A data frame with at least columns: rfid, common_dt, variable, and value

direction

Either "above" or "below"

threshold

Numeric threshold to compare temperature values against

greedy

Logical. If TRUE, allow bouts to continue through NAs. Default is FALSE.

max_gap

Numeric. Maximum number of consecutive NA values allowed within a bout. Note: bouts are still broken by non-NA values that fail the threshold condition.

Value

A data frame with one row per bout per animal, with start/end/duration