Datos de un hospital

library(conflicted)
library(readxl)
library(dplyr)
library(ggplot2)
library(plotly)
library(summarytools)
library(modeest)
library(RColorBrewer)
library(tidyverse)
library(gapminder)
library(modeest)
#install.packages("modeest")

#RETO 8

B. Identifica el tipo de variables que la conforman: deja plasmado en el documento el tipo de variables que encontraste.

[1] "numeric"
[1] "character"
[1] "character"
[1] "NULL"
[1] "NULL"
[1] "NULL"
[1] "NULL"
[1] "NULL"
[1] "NULL"
[1] "NULL"
[1] "NULL"
[1] "NULL"
[1] "NULL"

C. Lee y explora la base datos (formato .csv): puede hacerse con una función o con las funcionalidades de RStudio.

colnames(BasedeDatos)
 [1] "AÑO"                    "DEPARTAMENTO"           "MUNICIPIO"             
 [4] "AREA NACIMIENTO"        "SEXO"                   "PESO (Gramos)"         
 [7] "TALLA (Centímetros)"    "FECHA NACIMIENTO"       "TIEMPO DE GESTACIÓN"   
[10] "CONSULTAS PRENATALES"   "TIPO PARTO"             "MULTIPLICIDAD EMBARAZO"
[13] "EDAD MADRE"             "EDAD PADRE"            
str(BasedeDatos)
tibble [1,821 × 14] (S3: tbl_df/tbl/data.frame)
 $ AÑO                   : num [1:1821] 2022 2022 2022 2022 2022 ...
 $ DEPARTAMENTO          : chr [1:1821] "ANTIOQUIA" "ANTIOQUIA" "ANTIOQUIA" "ANTIOQUIA" ...
 $ MUNICIPIO             : chr [1:1821] "RIONEGRO" "RIONEGRO" "RIONEGRO" "RIONEGRO" ...
 $ AREA NACIMIENTO       : chr [1:1821] "CABECERA MUNICIPAL" "CABECERA MUNICIPAL" "CABECERA MUNICIPAL" "CABECERA MUNICIPAL" ...
 $ SEXO                  : chr [1:1821] "FEMENINO" "FEMENINO" "MASCULINO" "MASCULINO" ...
 $ PESO (Gramos)         : num [1:1821] 3350 2810 3040 4150 3530 3070 2850 2940 2880 2860 ...
 $ TALLA (Centímetros)   : num [1:1821] 47 47 48 53 50 49 47 48 47 45 ...
 $ FECHA NACIMIENTO      : chr [1:1821] "12/31/2022 12:00:00 AM" "12/31/2022 12:00:00 AM" "12/31/2022 12:00:00 AM" "12/31/2022 12:00:00 AM" ...
 $ TIEMPO DE GESTACIÓN   : num [1:1821] 37 38 37 39 39 38 39 41 38 39 ...
 $ CONSULTAS PRENATALES  : num [1:1821] 7 8 8 9 8 5 6 3 7 7 ...
 $ TIPO PARTO            : chr [1:1821] "CESÁREA" "CESÁREA" "ESPONTÁNEO" "CESÁREA" ...
 $ MULTIPLICIDAD EMBARAZO: chr [1:1821] "SIMPLE" "SIMPLE" "SIMPLE" "SIMPLE" ...
 $ EDAD MADRE            : num [1:1821] 30 23 18 28 29 37 17 23 24 20 ...
 $ EDAD PADRE            : num [1:1821] 43 27 17 28 36 30 22 54 25 23 ...

Renombra las columnas Peso (gramos) y Talla (centímetros).

 [1] "AÑO"                    "DEPARTAMENTO"           "MUNICIPIO"             
 [4] "AREA NACIMIENTO"        "SEXO"                   "PESO (Gramos)"         
 [7] "TALLA (Centímetros)"    "FECHA NACIMIENTO"       "TIEMPO DE GESTACIÓN"   
[10] "CONSULTAS PRENATALES"   "TIPO PARTO"             "MULTIPLICIDAD EMBARAZO"
[13] "EDAD MADRE"             "EDAD PADRE"            

Asegúrate de que R haya leído el tipo de variable correctamente; en caso contrario, cámbialo.

#Cambiar los tipos de datos
BasedeDatos$Peso <- as.numeric(BasedeDatos$Peso)
BasedeDatos$Talla <- as.numeric(BasedeDatos$Talla)

# Verificar los cambios realizados:
str(BasedeDatos)
tibble [1,821 × 14] (S3: tbl_df/tbl/data.frame)
 $ AÑO                   : num [1:1821] 2022 2022 2022 2022 2022 ...
 $ DEPARTAMENTO          : chr [1:1821] "ANTIOQUIA" "ANTIOQUIA" "ANTIOQUIA" "ANTIOQUIA" ...
 $ MUNICIPIO             : chr [1:1821] "RIONEGRO" "RIONEGRO" "RIONEGRO" "RIONEGRO" ...
 $ Area_nacimiento       : chr [1:1821] "CABECERA MUNICIPAL" "CABECERA MUNICIPAL" "CABECERA MUNICIPAL" "CABECERA MUNICIPAL" ...
 $ Sexo                  : chr [1:1821] "FEMENINO" "FEMENINO" "MASCULINO" "MASCULINO" ...
 $ Peso                  : num [1:1821] 3350 2810 3040 4150 3530 3070 2850 2940 2880 2860 ...
 $ Talla                 : num [1:1821] 47 47 48 53 50 49 47 48 47 45 ...
 $ Fecha_nacimiento      : chr [1:1821] "12/31/2022 12:00:00 AM" "12/31/2022 12:00:00 AM" "12/31/2022 12:00:00 AM" "12/31/2022 12:00:00 AM" ...
 $ Tiempo_gestacion      : num [1:1821] 37 38 37 39 39 38 39 41 38 39 ...
 $ Consultas_prenatales  : num [1:1821] 7 8 8 9 8 5 6 3 7 7 ...
 $ Tipo_parto            : chr [1:1821] "CESÁREA" "CESÁREA" "ESPONTÁNEO" "CESÁREA" ...
 $ Multiplicidad_embarazo: chr [1:1821] "SIMPLE" "SIMPLE" "SIMPLE" "SIMPLE" ...
 $ Edad_madre            : num [1:1821] 30 23 18 28 29 37 17 23 24 20 ...
 $ Edad_padre            : num [1:1821] 43 27 17 28 36 30 22 54 25 23 ...

Identifica si hay valores faltantes.

colSums(is.na(BasedeDatos))
                   AÑO           DEPARTAMENTO              MUNICIPIO 
                     0                      0                      0 
       Area_nacimiento                   Sexo                   Peso 
                     0                      0                      0 
                 Talla       Fecha_nacimiento       Tiempo_gestacion 
                     0                      0                   1714 
  Consultas_prenatales             Tipo_parto Multiplicidad_embarazo 
                     0                      0                      0 
            Edad_madre             Edad_padre 
                     0                     13 

Reto 9

Resumen del marco de datos (función summary).

summary(BasedeDatos)
      AÑO       DEPARTAMENTO        MUNICIPIO         Area_nacimiento   
 Min.   :2022   Length:1821        Length:1821        Length:1821       
 1st Qu.:2022   Class :character   Class :character   Class :character  
 Median :2022   Mode  :character   Mode  :character   Mode  :character  
 Mean   :2022                                                           
 3rd Qu.:2022                                                           
 Max.   :2022                                                           
                                                                        
     Sexo                Peso          Talla       Fecha_nacimiento  
 Length:1821        Min.   : 700   Min.   :32.00   Length:1821       
 Class :character   1st Qu.:2840   1st Qu.:47.00   Class :character  
 Mode  :character   Median :3080   Median :48.00   Mode  :character  
                    Mean   :3093   Mean   :48.31                     
                    3rd Qu.:3320   3rd Qu.:50.00                     
                    Max.   :4610   Max.   :55.00                     
                                                                     
 Tiempo_gestacion Consultas_prenatales  Tipo_parto       
 Min.   :37.00    Min.   : 0.000       Length:1821       
 1st Qu.:38.00    1st Qu.: 5.000       Class :character  
 Median :39.00    Median : 7.000       Mode  :character  
 Mean   :38.75    Mean   : 6.625                         
 3rd Qu.:40.00    3rd Qu.: 8.000                         
 Max.   :41.00    Max.   :18.000                         
 NA's   :1714                                            
 Multiplicidad_embarazo   Edad_madre      Edad_padre   
 Length:1821            Min.   :14.00   Min.   :16.00  
 Class :character       1st Qu.:20.00   1st Qu.:23.00  
 Mode  :character       Median :24.00   Median :28.00  
                        Mean   :25.29   Mean   :29.45  
                        3rd Qu.:29.00   3rd Qu.:34.00  
                        Max.   :45.00   Max.   :77.00  
                                        NA's   :13     

Media, mediana y desviación estándar para las variables cuantitativas (peso, talla, tiempo de gestación y consultas prenatales):

BasedeDatos %>% 
  summarise(
    Cantidad_pacientes = n(),
    
    peso_media = mean(Peso, na.rm = TRUE),
    peso_mediana = median(Peso, na.rm = TRUE),
    peso_sd = sd(Peso, na.rm = TRUE),
    
    talla_media = mean(Talla, na.rm = TRUE),
    talla_mediana = median(Talla, na.rm = TRUE),
    talla_sd = sd(Talla, na.rm = TRUE),
    
    tgestacion_media = mean(Tiempo_gestacion, na.rm = TRUE),
    tgestacion_mediana = median(Tiempo_gestacion, na.rm = TRUE),
    tgestacion_sd = sd(Tiempo_gestacion, na.rm = TRUE),
    
    consultasp_media = mean(Consultas_prenatales, na.rm = TRUE),
    consultasp_mediana = median(Consultas_prenatales, na.rm = TRUE),
    consultasp_sd = sd(Consultas_prenatales, na.rm = TRUE))
# A tibble: 1 × 13
  Cantidad_pacientes peso_media peso_mediana peso_sd talla_media talla_mediana
               <int>      <dbl>        <dbl>   <dbl>       <dbl>         <dbl>
1               1821      3093.         3080    364.        48.3            48
# ℹ 7 more variables: talla_sd <dbl>, tgestacion_media <dbl>,
#   tgestacion_mediana <dbl>, tgestacion_sd <dbl>, consultasp_media <dbl>,
#   consultasp_mediana <dbl>, consultasp_sd <dbl>

Moda para las variables cualitativas: sexo y multiplicidad de embarazo.

BasedeDatos %>% 
  summarise(
    moda_sexo = mlv(Sexo),
    moda_multiplicidad = mlv(Multiplicidad_embarazo),
  )
# A tibble: 1 × 2
  moda_sexo moda_multiplicidad
  <chr>     <chr>             
1 MASCULINO SIMPLE            

Medida agrupando una variable (Group by): cantidad de nacimientos por área nacimiento.

BasedeDatos %>%
  group_by(Area_nacimiento) %>%
  summarise(Cantidad_Nacimientos = n())
# A tibble: 2 × 2
  Area_nacimiento    Cantidad_Nacimientos
  <chr>                             <int>
1 CABECERA MUNICIPAL                 1818
2 RURAL DISPERSO                        3

Medida con información filtrada (Filter): peso y talla promedio de los niños con siete o más consultas prenatales y cantidad de niños con padres mayores a 35 años.

# Peso y Talla proemdio de los niños con 7 o mas consultas prenatales
BasedeDatos %>% 
  dplyr::filter(Consultas_prenatales >= 7) %>% 
  summarise(
    cantidad_promediocp = n(),
    peso_promediocp = mean(Peso, na.rm = TRUE),
    talla_promediocp = mean(Talla, na.rm = TRUE)
  )
# A tibble: 1 × 3
  cantidad_promediocp peso_promediocp talla_promediocp
                <int>           <dbl>            <dbl>
1                1076           3112.             48.4
# Cantidad de niños con padres mayores a 35 años
BasedeDatos %>%
  dplyr::filter(Edad_padre > 35) %>%
  summarise(cantidad_ninos = n())
# A tibble: 1 × 1
  cantidad_ninos
           <int>
1            365

Gráfico de barras: nacimientos registrados por sexo y tipo de parto y nacimientos registrados por área de nacimiento y tipo de parto.

Grafico_Barras <- ggplot(BasedeDatos, aes(x = Sexo, fill = Tipo_parto)) +
  geom_bar() + 
  labs(
    title = "Nacimientos por Sexo y Tipo de Parto",
    subtitle = "Gráfico de barras",
    x="Sexo", 
    y ="Cantidad",
    fill = "Tipo de Parto") +
  scale_fill_manual(values = c("CESÁREA" = "pink", "ESPONTÁNEO" = "blue", "INSTRUMENTADO" = "red"))
  theme_classic()
List of 136
 $ line                            :List of 6
  ..$ colour       : chr "black"
  ..$ linewidth    : num 0.5
  ..$ linetype     : num 1
  ..$ lineend      : chr "butt"
  ..$ arrow        : logi FALSE
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_line" "element"
 $ rect                            :List of 5
  ..$ fill         : chr "white"
  ..$ colour       : chr "black"
  ..$ linewidth    : num 0.5
  ..$ linetype     : num 1
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_rect" "element"
 $ text                            :List of 11
  ..$ family       : chr ""
  ..$ face         : chr "plain"
  ..$ colour       : chr "black"
  ..$ size         : num 11
  ..$ hjust        : num 0.5
  ..$ vjust        : num 0.5
  ..$ angle        : num 0
  ..$ lineheight   : num 0.9
  ..$ margin       : 'margin' num [1:4] 0points 0points 0points 0points
  .. ..- attr(*, "unit")= int 8
  ..$ debug        : logi FALSE
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ title                           : NULL
 $ aspect.ratio                    : NULL
 $ axis.title                      : NULL
 $ axis.title.x                    :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : NULL
  ..$ hjust        : NULL
  ..$ vjust        : num 1
  ..$ angle        : NULL
  ..$ lineheight   : NULL
  ..$ margin       : 'margin' num [1:4] 2.75points 0points 0points 0points
  .. ..- attr(*, "unit")= int 8
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ axis.title.x.top                :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : NULL
  ..$ hjust        : NULL
  ..$ vjust        : num 0
  ..$ angle        : NULL
  ..$ lineheight   : NULL
  ..$ margin       : 'margin' num [1:4] 0points 0points 2.75points 0points
  .. ..- attr(*, "unit")= int 8
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ axis.title.x.bottom             : NULL
 $ axis.title.y                    :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : NULL
  ..$ hjust        : NULL
  ..$ vjust        : num 1
  ..$ angle        : num 90
  ..$ lineheight   : NULL
  ..$ margin       : 'margin' num [1:4] 0points 2.75points 0points 0points
  .. ..- attr(*, "unit")= int 8
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ axis.title.y.left               : NULL
 $ axis.title.y.right              :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : NULL
  ..$ hjust        : NULL
  ..$ vjust        : num 1
  ..$ angle        : num -90
  ..$ lineheight   : NULL
  ..$ margin       : 'margin' num [1:4] 0points 0points 0points 2.75points
  .. ..- attr(*, "unit")= int 8
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ axis.text                       :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : chr "grey30"
  ..$ size         : 'rel' num 0.8
  ..$ hjust        : NULL
  ..$ vjust        : NULL
  ..$ angle        : NULL
  ..$ lineheight   : NULL
  ..$ margin       : NULL
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ axis.text.x                     :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : NULL
  ..$ hjust        : NULL
  ..$ vjust        : num 1
  ..$ angle        : NULL
  ..$ lineheight   : NULL
  ..$ margin       : 'margin' num [1:4] 2.2points 0points 0points 0points
  .. ..- attr(*, "unit")= int 8
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ axis.text.x.top                 :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : NULL
  ..$ hjust        : NULL
  ..$ vjust        : num 0
  ..$ angle        : NULL
  ..$ lineheight   : NULL
  ..$ margin       : 'margin' num [1:4] 0points 0points 2.2points 0points
  .. ..- attr(*, "unit")= int 8
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ axis.text.x.bottom              : NULL
 $ axis.text.y                     :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : NULL
  ..$ hjust        : num 1
  ..$ vjust        : NULL
  ..$ angle        : NULL
  ..$ lineheight   : NULL
  ..$ margin       : 'margin' num [1:4] 0points 2.2points 0points 0points
  .. ..- attr(*, "unit")= int 8
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ axis.text.y.left                : NULL
 $ axis.text.y.right               :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : NULL
  ..$ hjust        : num 0
  ..$ vjust        : NULL
  ..$ angle        : NULL
  ..$ lineheight   : NULL
  ..$ margin       : 'margin' num [1:4] 0points 0points 0points 2.2points
  .. ..- attr(*, "unit")= int 8
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ axis.text.theta                 : NULL
 $ axis.text.r                     :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : NULL
  ..$ hjust        : num 0.5
  ..$ vjust        : NULL
  ..$ angle        : NULL
  ..$ lineheight   : NULL
  ..$ margin       : 'margin' num [1:4] 0points 2.2points 0points 2.2points
  .. ..- attr(*, "unit")= int 8
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ axis.ticks                      :List of 6
  ..$ colour       : chr "grey20"
  ..$ linewidth    : NULL
  ..$ linetype     : NULL
  ..$ lineend      : NULL
  ..$ arrow        : logi FALSE
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_line" "element"
 $ axis.ticks.x                    : NULL
 $ axis.ticks.x.top                : NULL
 $ axis.ticks.x.bottom             : NULL
 $ axis.ticks.y                    : NULL
 $ axis.ticks.y.left               : NULL
 $ axis.ticks.y.right              : NULL
 $ axis.ticks.theta                : NULL
 $ axis.ticks.r                    : NULL
 $ axis.minor.ticks.x.top          : NULL
 $ axis.minor.ticks.x.bottom       : NULL
 $ axis.minor.ticks.y.left         : NULL
 $ axis.minor.ticks.y.right        : NULL
 $ axis.minor.ticks.theta          : NULL
 $ axis.minor.ticks.r              : NULL
 $ axis.ticks.length               : 'simpleUnit' num 2.75points
  ..- attr(*, "unit")= int 8
 $ axis.ticks.length.x             : NULL
 $ axis.ticks.length.x.top         : NULL
 $ axis.ticks.length.x.bottom      : NULL
 $ axis.ticks.length.y             : NULL
 $ axis.ticks.length.y.left        : NULL
 $ axis.ticks.length.y.right       : NULL
 $ axis.ticks.length.theta         : NULL
 $ axis.ticks.length.r             : NULL
 $ axis.minor.ticks.length         : 'rel' num 0.75
 $ axis.minor.ticks.length.x       : NULL
 $ axis.minor.ticks.length.x.top   : NULL
 $ axis.minor.ticks.length.x.bottom: NULL
 $ axis.minor.ticks.length.y       : NULL
 $ axis.minor.ticks.length.y.left  : NULL
 $ axis.minor.ticks.length.y.right : NULL
 $ axis.minor.ticks.length.theta   : NULL
 $ axis.minor.ticks.length.r       : NULL
 $ axis.line                       :List of 6
  ..$ colour       : chr "black"
  ..$ linewidth    : 'rel' num 1
  ..$ linetype     : NULL
  ..$ lineend      : NULL
  ..$ arrow        : logi FALSE
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_line" "element"
 $ axis.line.x                     : NULL
 $ axis.line.x.top                 : NULL
 $ axis.line.x.bottom              : NULL
 $ axis.line.y                     : NULL
 $ axis.line.y.left                : NULL
 $ axis.line.y.right               : NULL
 $ axis.line.theta                 : NULL
 $ axis.line.r                     : NULL
 $ legend.background               :List of 5
  ..$ fill         : NULL
  ..$ colour       : logi NA
  ..$ linewidth    : NULL
  ..$ linetype     : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_rect" "element"
 $ legend.margin                   : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
  ..- attr(*, "unit")= int 8
 $ legend.spacing                  : 'simpleUnit' num 11points
  ..- attr(*, "unit")= int 8
 $ legend.spacing.x                : NULL
 $ legend.spacing.y                : NULL
 $ legend.key                      : NULL
 $ legend.key.size                 : 'simpleUnit' num 1.2lines
  ..- attr(*, "unit")= int 3
 $ legend.key.height               : NULL
 $ legend.key.width                : NULL
 $ legend.key.spacing              : 'simpleUnit' num 5.5points
  ..- attr(*, "unit")= int 8
 $ legend.key.spacing.x            : NULL
 $ legend.key.spacing.y            : NULL
 $ legend.frame                    : NULL
 $ legend.ticks                    : NULL
 $ legend.ticks.length             : 'rel' num 0.2
 $ legend.axis.line                : NULL
 $ legend.text                     :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : 'rel' num 0.8
  ..$ hjust        : NULL
  ..$ vjust        : NULL
  ..$ angle        : NULL
  ..$ lineheight   : NULL
  ..$ margin       : NULL
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ legend.text.position            : NULL
 $ legend.title                    :List of 11
  ..$ family       : NULL
  ..$ face         : NULL
  ..$ colour       : NULL
  ..$ size         : NULL
  ..$ hjust        : num 0
  ..$ vjust        : NULL
  ..$ angle        : NULL
  ..$ lineheight   : NULL
  ..$ margin       : NULL
  ..$ debug        : NULL
  ..$ inherit.blank: logi TRUE
  ..- attr(*, "class")= chr [1:2] "element_text" "element"
 $ legend.title.position           : NULL
 $ legend.position                 : chr "right"
 $ legend.position.inside          : NULL
 $ legend.direction                : NULL
 $ legend.byrow                    : NULL
 $ legend.justification            : chr "center"
 $ legend.justification.top        : NULL
 $ legend.justification.bottom     : NULL
 $ legend.justification.left       : NULL
 $ legend.justification.right      : NULL
 $ legend.justification.inside     : NULL
 $ legend.location                 : NULL
 $ legend.box                      : NULL
 $ legend.box.just                 : NULL
 $ legend.box.margin               : 'margin' num [1:4] 0cm 0cm 0cm 0cm
  ..- attr(*, "unit")= int 1
 $ legend.box.background           : list()
  ..- attr(*, "class")= chr [1:2] "element_blank" "element"
 $ legend.box.spacing              : 'simpleUnit' num 11points
  ..- attr(*, "unit")= int 8
  [list output truncated]
 - attr(*, "class")= chr [1:2] "theme" "gg"
 - attr(*, "complete")= logi TRUE
 - attr(*, "validate")= logi TRUE
ggplotly(Grafico_Barras)
print(Grafico_Barras)

Gráfico de dispersión: variable peso vs. talla.

Grafico_Dispersion <- ggplot(BasedeDatos, aes(x = Talla, y = Peso, color = Sexo, size = Talla)) +  
  geom_point(alpha = 1, size= 1, shape = 16) +  
  labs(
    title = "Dispersión de Peso vs Talla",
    subtitle = "Gráfico de dispersión"
  ) +
  scale_color_manual(values = c("FEMENINO" = "pink", "MASCULINO" = "navy")) +
  scale_size_continuous(range = c(1, 5)) +  
  theme_minimal()

ggplotly(Grafico_Dispersion)

C. Conclusiones:

En la gran mayoría de las observaciones no se reportó las semanas de gestación, por tanto, lo cual resulta importante al definir posible causa que haya motivado cesarea o parto instrumentado, respecto a otros datos faltante hay un minimo numero de datos faltantes respecto a la edad del padre, del resto de variables se obtuvo completa toda la información. Se notan una distribución asimetrica en la forma del parto, con un menor numero de eventos de partos instrumentados, la cesarea y el parto espontaneo son equiparables, con un mayor numero de cesareas, respecto a los nacimientos, los recien nacidos fueron mayormente de sexo masculino.

El rango del peso se presentó entre 700 y 4610 gramos y respecto a la talla el rango fue de 32 a 55 cm, lo cual evidencia casos de bajo peso al nacer y macrosomia fetal, ambos casos de gran relevancia clínica dado que dichos nacidos tendrán un mayor riesgo de morbimoratalida, por tanto son datos de interés que motivan estudios futuros, respecto a los posibles factores desencadenantes.

#GRACIAS.