expand_periods: Expand time periods into a 'tibble' of equally spaced time...

View source: R/utils.R

expand_periodsR Documentation

Expand time periods into a tibble of equally spaced time points

Description

Expand time periods into a tibble of equally spaced time points

Usage

expand_periods(periods, start_var, end_var, units = "1 min")

Arguments

periods

A tibble with at least two columns, start_var and end_var which are the first and the last epoch in a set of time periods, e.g. sleep periods or (non)wear periods.

start_var

The variable (unquoted) which indicates when the time periods start.

end_var

The variable (unquoted) which indicates when the time periods end.

units

The time unit as a characters string. The default is "1 min".

Value

A tibble with two columns: period_id identifies the input period and timestamp is a POSIXct vector of time points within that period, equally spaced by units. Any grouping of periods is preserved.

Examples

library("dplyr")
data("gtxplus1day")

gtxplus1day %>%
  collapse_epochs(60) %>%
  apply_choi(min_period_len = 45) %>%
  expand_periods(period_start, period_end, units = "30 mins")

actigraph.sleepr documentation built on Sept. 12, 2026, 5:08 p.m.