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)
Run the code above in your browser using DataLab