if (FALSE) {
# Read file "a03" from the physionet apnea-ecg database
library(RHRV)
HRVData <- CreateHRVData()
HRVData <- LoadBeatWFDB(HRVData,RecordName="test_files/WFDB/a03")
HRVData <- LoadApneaWFDB(HRVData,RecordName="test_files/WFDB/a03")
# Add other type of episode for a more complete example (this episode does
# not have any physiological meaning)
HRVData <- AddEpisodes(HRVData,InitTimes=c(4500),Durations=c(1000),
Tags="Other", Values = 1)
HRVData <- BuildNIHR(HRVData)
HRVData <- FilterNIHR(HRVData)
HRVData <- InterpolateNIHR(HRVData)
PlotHR(HRVData)
OverplotEpisodes(HRVData,ymark=c(150,151),eplim=c(20,150))
# Change some default parameters
PlotHR(HRVData)
OverplotEpisodes(HRVData,ymark=c(150,151),eplim=c(20,150),
epLegendCoords=c(25000,150), lty=5,
epColorPalette=c("blue","green"))
# Use episodic information with the spectrogram... In order to obtain a proper
# representation of the episodes we need to avoid the use of the spectrogram
# legend
sp <- PlotSpectrogram(HRVData, size=600, shift=60, freqRange=c(0,0.05),
showLegend=F);
OverplotEpisodes(HRVData, markEpisodes=T, ymark=c(0.04,0.0401),
eplim=c(0,0.04), Tags="APNEA",
epColorPalette = c("white"), lwd=3)
}
Run the code above in your browser using DataLab