Learn R Programming

⚠️There's a newer version (1.0.12) of this package.Take me there.

rsleep: A R package for sleep data analysis

rsleep is a multiplatform open-source R package providing a toolbox for sleep data processing, visualization and analysis. rsleep provides tools for state of the art automatic sleep stages scoring.

Installation

Development version can be directly installed from Github using the devtools package :

devtools::install_github("boupetch/rsleep")

Stable version can be downloaded and installed from CRAN:

install.packages("rsleep")

Usage

library(rsleep)

Vignettes

Examples

Plotting a spectrogram

Detecting R peaks in ECG signal

Processing a hypnogram

Plotting a hypnodensity

Computing a transition matrix

Citation

@software{paul_bouchequet_2022_7474289,
  author       = {Paul Bouchequet},
  title        = {rsleep},
  month        = dec,
  year         = 2022,
  publisher    = {Zenodo},
  version      = {1.0.6},
  doi          = {10.5281/zenodo.7416363},
  url          = {https://doi.org/10.5281/zenodo.7416363}
}

rsleep usage in scientific litterature

Copy Link

Version

Install

install.packages('rsleep')

Monthly Downloads

86

Version

1.0.7

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Paul Bouchequet

Last Published

June 11th, 2023

Functions in rsleep (1.0.7)

smooth_liang2012

Smooth hypnogram according to the 11 rules described by Liang & Al.
read_events_sleepedfx

Read a SleepEDFX events file EDF+
score_mice

Score mice sleep from European Data Format (EDF) files.
score_psg

Score 30 seconds epochs from European Data Format (EDF) files.
train_batches

Trains a model from files batches.
stages_stats

Get stages related statistics in a named vector.
read_events_noxturnal

Read a Noxturnal events file (Unicode CSV format)
tst90

Compute TST90, the percentage of time during sleep with an oxygen saturation below 90.
spectrogram

Plot the spectrogram of signal.
transitions

Count and format stages transitions.
segmentation

Split signals into consecutive, overlapping segments.
smooth_hypnogram

Smooth hypnogram epoch, simulating human scorers behaviour.
write_mdf

Write a European Data Format (EDF) record file to disk using Morpheo Data Format (MDF) guidelines
write_channel

Write a timeserie to disk using Morpheo Data Format (MDF) guidelines.
write_hypnogram_compumedics

Write a XML file containing scored stages for Compumedics software.
plot_hypnodensity

Plot a hypnodensity graph.
read_mdf

Read a Morpheo Data Format (MDF) directory to a list.
write_batches_mice

Write batches from mice records
schwabedal2018

Automated Classification of Sleep Stages in Mice with Deep Learning model implementation in Keras.
write_batches_psg

Generates files batches from PSG data.
chambon2018

Deep Learning Architecture for Temporal Sleep Stage Classification model implementation in Keras.
check_events

Check events dataframe format compliance.
ckappa

Computes Cohen's Kappa for agreement in the case of 2 raters.
bands_psd

Compute power spectral density of bands listed in the bands argument.
detect_rpeaks

Detect R peaks in a raw ECG signal.
periods

Get a dataframe of sleep periods from a hypnogram, continuous or by stages.
hypnogram

Filter and reorder an events dataframe or a hypnodensity to keep only sleep stages related-events.
choi2018

Convolutional neural network for real-time apnea-hypopnea event detection during sleep
epochs

Split signals into consecutive, non-overlaping epochs according to an events dataframe or an epoch duration.
normalize_cycles

Normalize sleep cycles scored on Noxturnal software from start and stop flags to unique events.
psm

Power spectral density using adaptive sine multitaper.
plot_hypnogram

Plot a hypnogram from an events dataframe.
read_events_profusion

Read a annotation file from Compumedics Profusion software in XML format.
read_events_compumedics

Read a stages export from Compumedics software in .txt format.
pwelch

Power spectral density using Welch's method.
read_events_ndb

Read events from a Resmed Noxturnal .ndb file.
plot_event

Highlight a scored event over a signal.