interval_join: Join data at different time-scales

View source: R/interval_join.R

interval_joinR Documentation

Join data at different time-scales

Description

Given one dataset where each row represents an interval at coarser scale (for example, one row per dive with dive start/end times), pull in summary information about finer-time-scale data. For example, add the max RL during each dive, or the median MSA during each dive.

Usage

interval_join(
  x,
  y,
  start_x,
  start_y,
  end_x = start_x,
  end_y,
  suffix = c("", ".new"),
  ...,
  keep = FALSE
)

Arguments

x

interval data frame or tibble (data with one row per dive, dive-cycle, day, etc.) Should have columns that provide start and end times of each interval; these can be date-times or any numeric time indicator

y

data frame at finer time-scale with information to summarize and pull into x

start_x

name of variable with interval start times in x

start_y

name of variable in y that contains sample times or event-start times

end_x

name of variable in x that contains interval end times (defaults to start_x if not given)

end_y

name of variable in y that contains event or sample end times (defaults to start_y if not given)

suffix

(Passed to left_join; most users can ignore) If there are non-joined duplicate variables in x and y, these suffixes will be added to the output to disambiguate them. Should be a character vector of length 2.

...

Additional arguments to pass to left_join

keep

(Passed to left_join; most users can ignore and keep the default value, FALSE) Should the join keys from both x and y be preserved in the output?

Value

A data.frame like the input interval dataset x, but with additional columns for the new summarized variables

Examples

# Examples will go here

stacyderuiter/FBtagtools documentation built on June 1, 2025, 6:26 p.m.