Compute standard heart rate variability (HRV) time-domain metrics from RR interval data. Calculates SDNN, RMSSD, pNN50, mean RR interval, and mean heart rate for each channel.
Arguments
- rr
A data.frame with columns
channel,rr_ms, andtime_sec, as returned byecgRRintervals.- rhythm_check
Logical; if
TRUE(default), gate the result onecgDetectAF: metrics for channels classified as AF or frequent ectopy are set toNAandrhythm/hrv_validcolumns are appended (HRV is undefined in atrial fibrillation).
Value
A data.frame with one row per channel and the following columns:
- channel
Integer channel index.
- mean_rr
Mean RR interval in milliseconds.
- sdnn
Standard deviation of all RR intervals (ms), reflecting overall HRV.
- rmssd
Root mean square of successive RR interval differences (ms), reflecting short-term vagal modulation.
- pnn50
Percentage of successive RR intervals differing by more than 50 ms.
- mean_hr
Mean heart rate in beats per minute (60000 / mean_rr).
References
Task Force of the European Society of Cardiology and the North American Society of Pacing and Electrophysiology (1996). "Heart rate variability: Standards of measurement, physiological interpretation and clinical use." Circulation, 93(5), 1043–1065.
See also
ecgRRintervals for computing RR intervals,
ecgHRVfreq for frequency-domain HRV analysis,
ecgHRVnonlinear for nonlinear HRV metrics,
ecgQualityCheck for ectopic beat detection before analysis.
Examples
set.seed(1)
n <- 300
time_sec <- cumsum(rep(0.85, n))
rr_ms <- 850 + 30 * sin(2 * pi * 0.1 * time_sec) + rnorm(n, sd = 15)
rr <- data.frame(channel = 1L, rr_ms = rr_ms, time_sec = time_sec)
ecgHRVtime(rr)
#> channel mean_rr sdnn rmssd pnn50 mean_hr rhythm hrv_valid
#> 1 1 850.8693 26.07409 24.08028 3.67893 70.51612 sinus TRUE