Skip to contents

Given a morning-entry data frame row (as produced internally by read_export()), returns additional computed columns:

Usage

compute_sleep_vars(df)

Arguments

df

A data frame with morning-entry columns (output of diary_long()).

Value

The same data frame with additional computed columns appended.

Details

VariableDefinition
tib_minTime in bed (rise_time − bed_time), minutes
tst_minTotal sleep time (TIB − SOL − WASO), minutes
se_pctSleep efficiency (TST / TIB × 100), %
sol_flagTRUE if SOL > 30 min (clinically significant)
se_flagTRUE if SE < 85% (below healthy threshold)
waso_flagTRUE if WASO > 30 min (clinically significant)
tst_flagTRUE if TST < 7 h (below recommended)

Clock-time fields (bed_time, rise_time) are decimal hours. Overnight wrap is handled by adding 24 when rise_time ≤ bed_time.