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