hypnogram | R Documentation |
Remove non-sleep stages events and reorder dataframe rows using the begin
column.
hypnogram(
events,
labels = c("N3", "N2", "N1", "REM", "AWA"),
startTime = 946681200,
epoch_duration = 30,
plot = FALSE
)
events |
Events dataframe. Dataframe must have |
labels |
Sleep stages labels. Defaults to |
startTime |
Hypnogram start time. Used when a hypnodensity dataframe is passed as events. Defaults to 946681200. |
epoch_duration |
Epoch duration in seconds. Used when a hypnodensity dataframe is passed as events. Defaults to 30. |
plot |
Plot the hypnogram or in not using |
Hypnogram dataframe or plot.
fpath <- paste0(tempdir(),"SC4001EC-Hypnogram.edf")
furl <- paste0("https://www.physionet.org/files/sleep-edfx/1.0.0/",
"sleep-cassette/SC4001EC-Hypnogram.edf?download")
download.file(furl,fpath)
events <- read_events_sleepedfx(fpath)
unlink(fpath)
hypnogram(events, plot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.