Los resultados muestran relaciones entre factores implicados como la
edad y el sexo con aspectos específicos de problemas en el corazón
library(readxl)
dataheart <- read_excel("a4_heart_disease_uci.xlsx")
View(dataheart)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.5.2
ggplot(dataheart, aes(x=age, y=chol)) +
geom_point(aes(color=sex), size=1, alpha= 0.8) +
geom_smooth(method = "loess", se = FALSE, color="black") +
labs(title = "Relación Age-Chol x Sexo") +
theme_minimal(base_size = 14)
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 30 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 30 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(dataheart, aes(x=thalch, y=oldpeak)) +
geom_point(alpha= 0.8, color ="green4") +
facet_wrap(~ sex) +
labs(title = "Relación entre Thalch-Oldpeak x Sexo") +
theme_minimal(base_size = 14) +
theme(
panel.grid = element_line(color = "gray90"),
axis.text.x = element_text(angle = 45, hjust = 1)
)
## Warning: Removed 63 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(dataheart, aes(x = trestbps, y = age, label = rownames(dataheart))) +
geom_point(color = "#1b9e77", size = 1) +
geom_text(vjust = 1.8,hjust =0.2, size = 2.5, color = "gray20",alpha =0.5) +
labs(title = "Relación Age-Trestbps") +
theme_minimal(base_size = 20)
## Warning: Removed 59 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 59 rows containing missing values or values outside the scale range
## (`geom_text()`).
