Imports a staged hypnogram from common formats and returns a tidy tibble
with one row per epoch. The resulting object is the standard input for all
other hypnoR functions.
Arguments
- path
Path to the hypnogram file.
- format
One of
"csv","edf_annotations","yasa","compumedics","nox", or"auto"(default). When"auto", the format is inferred from the file extension and header.- epoch_sec
Epoch duration in seconds. Default
30.- tz
Time zone string passed to
lubridate::as_datetime(). Default"UTC".- quiet
Suppress informational messages. Default
FALSE.
Value
A tibble with columns:
- epoch
Integer epoch index (1-based).
- time
POSIXcttimestamp for the start of each epoch.- stage
Ordered factor. Level set depends on staging resolution: full AASM (
W,N1,N2,N3,REM) or coarse actigraphy-derived (W,Sleep,Quiet sleep).- source
Character — the originating device / scorer label, if available in the file header.