hypnogram: Filter and reorder an events dataframe to keep only sleep...

Description Usage Arguments Value Examples

View source: R/events.R

Description

Remove non-sleep stages events and reorder dataframe rows using the begin column.

Usage

1
hypnogram(events, labels = c("N3", "N2", "N1", "REM", "AWA"))

Arguments

events

Events dataframe. Dataframe must have begin (POSIXt), end (POSIXt) and event

labels

Sleep stages labels. Defaults to c("N3","N2","N1","REM","AWA").

Value

hypnogram dataframe.

Examples

1
2
3
4
e <- data.frame(begin = as.POSIXlt(c(1536967800,1536967860,1536967830),origin = "1970-01-01"))
e$end <- as.POSIXlt(c(1536967830,1536967890,1536967860), origin = "1970-01-01")
e$event = c("back-position","N3","REM")
hypnogram(e)

Example output

                begin                 end event
3 2018-09-14 23:30:30 2018-09-14 23:31:00   REM
2 2018-09-14 23:31:00 2018-09-14 23:31:30    N3

rsleep documentation built on July 8, 2020, 6:19 p.m.