RHRV-package: RHRV: An R-based software package for the heart rate variability analysis of ECG recordings


RHRV offers functions for performing power spectral analysis of heart rate data. We will use this package for the study of several diseases, such as obstructive sleep apnoea or chronic obstructive pulmonary disease.


Package: RHRV
Type: Package
Version: 4.2.2
Date: 2016-11-15
License: GPL-2
LazyLoad: yes

This is a package for developing heart rate variability studies of ECG records. Data are read from an ascii file containing a column with beat positions in seconds. A function is included in order to build this file from an ECG record in WFDB format (visit the site http://www.physionet.org for more information).


An example including all the necessary steps to obtain and to
analyze by episodes the power bands of a wfdb register is
giving below:

##Reading a wfdb register and storing into a data structure:
md = CreateHRVData(Verbose = TRUE)
md = LoadBeatWFDB(md, RecordName = "register_name",
RecordPath = "register_path")

##Loading information of episodes of apnea:
md = LoadApneaWFDB(md, RecordName = "register_name",
RecordPath = "register_path", Tag = "APN")

##Generating new episodes before and after previous episodes of
md = GenerateEpisodes(md, NewBegFrom = "Beg", NewEndFrom = "Beg",
DispBeg = -600, DispEnd = -120, OldTag = "APN",
NewTag = "PREV_APN")
md = GenerateEpisodes(md, NewBegFrom = "End", NewEndFrom = "End",
DispBeg = 120, DispEnd = 600, OldTag = "APN",
NewTag = "POST_APN")

##Calculating heart rate signal:
md = BuildNIHR(md)

##Filtering heart rate signal:
md = FilterNIHR(md)

##Interpolating heart rate signal:
md = InterpolateNIHR(md)

##Calculating spectrogram and power per band:
md = CreateFreqAnalysis(md)
md = CalculatePowerBand(md, indexFreqAnalysis = 1, size = 120,
shift = 10, sizesp = 1024)

##Plotting power per band, including episodes information:
PlotPowerBand(md, indexFreqAnalysis = 1, hr = TRUE, ymax = 2400000,
ymaxratio = 3, Tag = "all")

##Splitting power per band using episodes before and after
episodes of apnea:
PrevAPN = SplitPowerBandByEpisodes(md, indexFreqAnalysis = 1,
Tag = "PREV_APN")
PostAPN = SplitPowerBandByEpisodes(md, indexFreqAnalysis = 1,
Tag = "POST_APN")

##Performing Student's t-test:
result = t.test(PrevAPN$InEpisodes$ULF, PostAPN$InEpisodes$ULF)


A. Mendez, L. Rodriguez, A. Otero, C.A. Garcia, X. Vila, M. Lado

Maintainer: Leandro Rodriguez-Linares <leandro@uvigo.es>


L. Rodriguez-Linares, L., A.J. Mendez, M.J. Lado, D.N. Olivieri, X.A. Vila, and I. Gomez-Conde, "An open source tool for heart rate variability spectral analysis", Computer Methods and Programs in Biomedicine 103(1):39-50, july 2011.

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.