Learn R Programming

rsleep: A R package for sleep data analysis

rsleep: Open-source, multiplatform R package for advanced sleep data analysis. Features automatic sleep scoring and sophisticated visualization tools.

Installation

Development version can be directly installed from Github :

remotes::install_github("boupetch/rsleep@dev")

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

Detecting spindles

Computing a transition matrix

Citation

@software{paul_bouchequet_2024_10507974,
  author       = {Paul Bouchequet},
  title        = {rsleep},
  doi          = {10.5281/zenodo.7416363},
  url          = {https://doi.org/10.5281/zenodo.7416363}
}

Publications using the rsleep package

Copy Link

Version

Install

install.packages('rsleep')

Monthly Downloads

68

Version

1.0.12

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Paul Bouchequet

Last Published

March 9th, 2024

Functions in rsleep (1.0.12)

normalize_cycles

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

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

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

Split signals into consecutive, overlapping segments.
plot_hypnogram

Plot a hypnogram from an events dataframe.
smooth_hypnogram

Smooth hypnogram epoch, simulating human scorers behaviour.
smooth_liang2012

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

Read events from a Resmed Noxturnal .ndb file.
read_mdf

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

Read a SleepEDFX events file EDF+
write_batches_mice

Write batches from mice records
plot_event

Highlight a scored event over a signal.
pwelch

Power spectral density using Welch's method.
epochs

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

Get stages related statistics in a named vector.
psm

Power spectral density using adaptive sine multitaper.
tst90

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

Plot the spectrogram of signal.
write_hypnogram_compumedics

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

Generates files batches from PSG data.
read_events_noxturnal

Read a Noxturnal events file (Unicode CSV format)
read_events_profusion

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

Trains a model from files batches.
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.
transitions

Count and format stages transitions.
schwabedal2018

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

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

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

Clean Oximetry Signal
adanorm

Adaptive Normalization of a Signal
bands_psd

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

A7 spindle detection algorithm
create_xts

Create an XTS Object from Resampled Signals
check_events

Check events dataframe format compliance.
ckappa

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

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

Bandpass Filter Function
chambon2018

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

Plot a hypnodensity graph.
detect_rpeaks

Detect R peaks in a raw ECG signal.
detect_rem

Detection of Rapid-Eye Movements (REMs)
detect_apneic_events

Detect Apneic Events in SpO2 Signal Data
periods

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