| create_block_ranges | R Documentation |
Identifies contiguous sleep episodes based on temporal gaps between valid sleep minutes. A new block is begins whenever the time difference between consecutive sleep records exceeds specified threshold. Function provides start and end times for each block and indicates whether they contain 'main' sleep.
create_block_ranges(exclusions_df, offset = "12:00", gap)
exclusions_df |
tbl. Data frame with columns |
offset |
character. Time of day |
gap |
numeric. Maximum allowed gap. |
tbl. A dataframe summarized at the sleep-block level, with the following columns:
participant_id: participant identifier
block_id: identifier for each sleep block
block_start: Start timestamp of each continous sleep block.
block_end: End timestamp of each continous sleep block.
main_block: Logical indicator of whether the block contains any main
sleep.
duration_min: Duration of each sleep block in minutes.
sleep_date: Sleep-aligned date based on specified offset.
exclusions_df: output of identify_hr_exclusions() or
identify_hr_recovery(); needs exclusion flags
function is specific to extended framework
input: offset sleep data with exclusion flags
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.