Code
fum_limpia %>%
select_if(is.numeric) %>%
corrr::correlate() %>%
corrr::network_plot(min_cor = 0.1,
colours = pint_ext("naranjac", "blanco", "verdec")) %>%
ggsave(filename = "output/imagenes/red.svg")Este proyecto está realizado mediante Quarto, el cual se puede descargar en este enlace https://quarto.org/docs/get-started/. Se recomienda actualizar a la versión más reciente de RStudio.
Por defecto los archivos .Rmd consideran como directorio de trabajo aquel en que ellos se encuentran. Sin embargo, por consistencia se opta por elegir como directorio de trabajo a aquel en que se encuentra el proyecto .Rproj. Para esto, basta con abrir los ajustes de RStudio -> RMarkdown -> Evaluate chunks in directory, y elegir Project.
Las primeras 10 observaciones del conjunto de datos:
# column: screen-inset
fum_limpia %>%
slice_head(n = 10) %>%
gt()| sexo | edad | estatura | peso | cintura | vista_izq | vista_der | escucha_izq | escucha_der | sistolica | relajacion | azucar | colesterol | trigliceridos | colesterol_bueno | colesterol_malo | hemoglobina | proteina_orina | creatinina | aspartato | alanina | transpeptidasa | caries | sarro | fumador |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Femenino | 40 | 155 | 60 | 81.3 | 1.2 | 1.0 | 1 | 1 | 114 | 73 | 94 | 215 | 82 | 73 | 126 | 12.9 | 1 | 0.7 | 18 | 19 | 27 | no | si | no |
| Femenino | 40 | 160 | 60 | 81.0 | 0.8 | 0.6 | 1 | 1 | 119 | 70 | 130 | 192 | 115 | 42 | 127 | 12.7 | 1 | 0.6 | 22 | 19 | 18 | no | si | no |
| Masculino | 55 | 170 | 60 | 80.0 | 0.8 | 0.8 | 1 | 1 | 138 | 86 | 89 | 242 | 182 | 55 | 151 | 15.8 | 1 | 1.0 | 21 | 16 | 22 | no | no | si |
| Masculino | 40 | 165 | 70 | 88.0 | 1.5 | 1.5 | 1 | 1 | 100 | 60 | 96 | 322 | 254 | 45 | 226 | 14.7 | 1 | 1.0 | 19 | 26 | 18 | no | si | no |
| Femenino | 40 | 155 | 60 | 86.0 | 1.0 | 1.0 | 1 | 1 | 120 | 74 | 80 | 184 | 74 | 62 | 107 | 12.5 | 1 | 0.6 | 16 | 14 | 22 | no | no | no |
| Masculino | 30 | 180 | 75 | 85.0 | 1.2 | 1.2 | 1 | 1 | 128 | 76 | 95 | 217 | 199 | 48 | 129 | 16.2 | 1 | 1.2 | 18 | 27 | 33 | no | si | no |
| Masculino | 40 | 160 | 60 | 85.5 | 1.0 | 1.0 | 1 | 1 | 116 | 82 | 94 | 226 | 68 | 55 | 157 | 17.0 | 1 | 0.7 | 21 | 27 | 39 | si | si | si |
| Masculino | 45 | 165 | 90 | 96.0 | 1.2 | 1.0 | 1 | 1 | 153 | 96 | 158 | 222 | 269 | 34 | 134 | 15.0 | 1 | 1.3 | 38 | 71 | 111 | no | si | no |
| Femenino | 50 | 150 | 60 | 85.0 | 0.7 | 0.8 | 1 | 1 | 115 | 74 | 86 | 210 | 66 | 48 | 149 | 13.7 | 1 | 0.8 | 31 | 31 | 14 | no | no | no |
| Masculino | 45 | 175 | 75 | 89.0 | 1.0 | 1.0 | 1 | 1 | 113 | 64 | 94 | 198 | 147 | 43 | 126 | 16.0 | 1 | 0.8 | 26 | 24 | 63 | no | no | no |
fum_limpia %>%
select_if(is.numeric) %>%
corrr::correlate() %>%
corrr::network_plot(min_cor = 0.1,
colours = pint_ext("naranjac", "blanco", "verdec")) %>%
ggsave(filename = "output/imagenes/red.svg")g_edad <- gg_int(fum_limpia, edad)g_estatura <- gg_int(fum_limpia, estatura, empuje = 400, etiq = 3)g_peso <- gg_int(fum_limpia, peso, ancho = 10, empuje = 300, etiq = 1.85)g_cintura <- gg_double(fum_limpia, cintura, num_bins = 20)Figure 1 figura
g_edad
g_estatura
g_pesog_cinturafum_limpia_vista <- fum_limpia %>%
select(vista_izq, vista_der) %>%
pivot_longer(everything(),
names_to = "vista",
values_to = "medicion",
names_prefix = "vista_") %>%
mutate(vista = if_else(vista == "izq", "izquierda", "derecha"))
gg_double_gr(fum_limpia_vista, medicion, vista)Claramente las distribuciones se enciman, por tanto se eliminará una de las variables.
fum_limpia_escucha <- fum_limpia %>%
select(escucha_izq, escucha_der) %>%
pivot_longer(everything(),
names_to = "escucha",
values_to = "medicion",
names_prefix = "escucha_") %>%
mutate(escucha = if_else(escucha == "izq", "izquierda", "derecha"))
gg_double_gr(fum_limpia_escucha, medicion, escucha)Claramente las distribuciones se enciman, por tanto se eliminará una de las variables.
gg_double(fum_limpia, sistolica, num_bins = 30, ancho = 20)gg_double(fum_limpia, relajacion, num_bins = 20, ancho = 20)gg_double(fum_limpia, azucar, num_bins = 30, ancho = 40)gg_double(fum_limpia, colesterol, num_bins = 30, ancho = 40)gg_double(fum_limpia, trigliceridos, num_bins = 35, ancho = 100)gg_double(fum_limpia, colesterol_bueno, num_bins = 50, ancho = 50)gg_double(fum_limpia, colesterol_malo, num_bins = 50, ancho = 200)gg_double(fum_limpia, hemoglobina, num_bins = 30, ancho = 2)gg_int(fum_limpia, proteina_orina, empuje = 1800, etiq = 4)gg_double(fum_limpia, creatinina, num_bins = 45, ancho = 1)gg_double(fum_limpia, aspartato, num_bins = 35, ancho = 200)gg_double(fum_limpia, alanina, num_bins = 30, ancho = 200)gg_double(fum_limpia, transpeptidasa, num_bins = 20, ancho = 100)gg_fact(fum_limpia, sexo, etiq = 4, empuje = 1400)gg_fact(fum_limpia, caries, etiq = 4, empuje = 1400)gg_fact(fum_limpia, sarro, etiq = 4, empuje = 1400)gg_fact(fum_limpia, fumador, etiq = 4, empuje = 1400)fum_limpia %>%
select(where(is.double), fumador) %>%
GGally::ggpairs(columns = 1:5,
mapping = aes(colour = fumador)) +
scale_colour_pint() +
scale_fill_pint() fum_limpia %>%
select(where(is.numeric), fumador) %>%
GGally::ggpairs(columns = 1:21,
mapping = aes(colour = fumador)) +
scale_colour_pint() +
scale_fill_pint()