hypnogram <- data.frame(begin = as.POSIXlt(
c(1536967800,1536967830,1536967860),origin = "1970-01-01"))
hypnogram$end <- as.POSIXlt(c(1536967830,1536967860,1536967890),
origin = "1970-01-01")
hypnogram$event = c("N3","N3","REM")
plot_hypnogram(hypnogram)
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)
hypnogram <- read_events_sleepedfx(fpath)
unlink(fpath)
plot_hypnogram(hypnogram)
Run the code above in your browser using DataLab