if (FALSE) {
# Load ECG data
ecg_data <- read_muse(system.file("extdata", "muse-sinus.xml", package = "EGM"))
# Extract lead II signal
signal <- ecg_data$signal$II
# Get sampling frequency from header
freq <- attributes(ecg_data$header)$record_line$frequency
# Detect QRS complexes
qrs_locations <- detect_QRS(signal, freq)
# Plot ECG with detected QRS complexes
plot(signal, type = "l", xlab = "Sample", ylab = "Amplitude")
points(qrs_locations, signal[qrs_locations], col = "red", pch = 19)
}
Run the code above in your browser using DataLab