Learn R Programming

DATAstudio (version 1.2.1)

ecg200: Electrocardiogram Data

Description

The ecg data frame has 200 rows and 97 columns. The data is the result of monitoring electrical activity recorded during one heartbeat and it consists of 200 ECG signals sampled at 96 time instants, corresponding to 133 normal heartbeats and 67 myocardial infarction signals.

Usage

ecg200

Arguments

Format

The ecg200 data frame contains the following columns:

status

: status of the patient, where 1 identifies subjects with myocardial infarction signals, and 0 identifies subjects with normal heartbeats.

i1 to i96

measurements at instants i1 to i96; to my knowledge the exact unit of time is unknown and is not specified by Olszewski (2001), who gathered the data.

References

de Carvalho, M. and Martos, G. (2024). Uncovering sets of maximum dissimilarity on random process data. Transactions on Machine Learning Research, 5, 1-31.

Olszewski, R. T. (2001). Generalized feature extraction for structural pattern recognition in time-series data. Carnegie Mellon University, PhD thesis.

Examples

Run this code
if (FALSE) {
## de Carvalho and Martos (2024, TMLR; Fig. 4)
if (!require("dplyr")) install.packages("dplyr")
if (!require("ggplot2")) install.packages("ggplot2")
if (!require("tidyr")) install.packages("tidyr")
    
packages <- c("dplyr", "ggplot2", "tidyr")
sapply(packages, require, character = TRUE)
longECG <- ecg200 
    pivot_longer(cols = starts_with("i"), names_to = "instant",
                 values_to = "value") 
    mutate(instant = as.integer(sub("i", "", instant)))  
    
# create scatter plot of pooled data
ggplot(longECG, aes(x = instant, y = value, color = factor(status))) +
    geom_point(size = 1, alpha = 0.3) +
    labs(color = "Status") +
    scale_color_manual(values = c("0" = "red", "1" = "blue"), 
                       labels = c("0" = "Non-diseased", "1" = "Diseased")) +
    xlab("Time") +
    ylab("ECG Signal") +
    theme_minimal()
}

Run the code above in your browser using DataLab