#### Analisis Exploratorio 12-02-2021
### Proyecto: CARDIOVAC
### Investigadores: Dra. Chaparro - Dr. Cruz
## Analistas: Yaset Caicedo - Akemi Arango


library(readxl)
library(dplyr)
## Warning: replacing previous import 'vctrs::data_frame' by 'tibble::data_frame'
## when loading 'dplyr'
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(janitor)
## 
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
library(skimr)


### Lectura de Base de Datos
cardiovac <- read_excel("DATA/CARDIOVAC_2020-05-06_registros_1-120.xlsx")
cardiovac <- cardiovac %>%
  filter(edad >= 1)
### 120 datos

### DESCRIPCION DE LOS DATOS

# Edad
cardiovac %>%
  skim(edad)
Data summary
Name Piped data
Number of rows 120
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
edad 0 1 60.06 12.78 21 53 62 69 82 ▁▂▃▇▅
#Genero
cardiovac %>%
  tabyl(sexo)
##  sexo  n   percent
##     0 37 0.3083333
##     1 83 0.6916667
## IMC
cardiovac %>%
  tabyl(imc)
##  imc  n    percent
##    0  7 0.05833333
##    1 48 0.40000000
##    2 42 0.35000000
##    3 16 0.13333333
##    4  2 0.01666667
##   SD  5 0.04166667
## Clase Funcional
cardiovac %>%
  tabyl(nyha)
##  nyha  n    percent
##     1 46 0.38333333
##     2 20 0.16666667
##     3 41 0.34166667
##     4 10 0.08333333
##    SD  3 0.02500000
################# Tipo de Cx Cardiovascular
cardiovac %>%
  tabyl(tipocx)
##  tipocx  n    percent
##       0  7 0.05833333
##       1  3 0.02500000
##       2  2 0.01666667
##       3 11 0.09166667
##       4 14 0.11666667
##       5 21 0.17500000
##       6 45 0.37500000
##       7  5 0.04166667
##       8 12 0.10000000
#### Antecedentes
## ERC
cardiovac %>%
  tabyl(anterc)
##  anterc   n    percent
##       0 112 0.93333333
##       1   8 0.06666667
## Enf Hepatica
cardiovac %>%
  tabyl(anthepatopatia)
##  anthepatopatia   n percent
##               0 117   0.975
##               1   3   0.025
## ICC
cardiovac %>%
  tabyl(anticc)
##  anticc  n percent
##       0 84     0.7
##       1 36     0.3
## DM2
cardiovac %>%
  tabyl(antdm)
##  antdm   n percent
##      0 108     0.9
##      1  12     0.1
## HTP
cardiovac %>%
  tabyl(anthtp)
##  anthtp   n   percent
##       0 104 0.8666667
##       1  16 0.1333333
## Coagulopatia
cardiovac %>%
  tabyl(antcoagulopatia)
##  antcoagulopatia   n    percent
##                0 116 0.96666667
##                1   4 0.03333333
##### Medicamentos Pre-QX

## ACO
cardiovac %>%
  tabyl(anticoagpreqx)
##  anticoagpreqx  n     percent
##              0 88 0.733333333
##              1 20 0.166666667
##              2 10 0.083333333
##              4  1 0.008333333
##              5  1 0.008333333
## Antiagregante
cardiovac %>%
  tabyl(antiagregpreqx)
##  antiagregpreqx  n     percent
##               0 86 0.716666667
##               1 28 0.233333333
##               2  5 0.041666667
##               3  1 0.008333333
#### CONDICION PREVIA

## FEVI Pre-QX
cardiovac %>%
  skim(fevipreqx)
Data summary
Name Piped data
Number of rows 120
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
fevipreqx 0 1 52.38 13.81 5 47.75 58 60 75 ▁▁▂▇▂
## Creatinina Pre-Qx
cardiovac %>%
  skim(crepreqx)
Data summary
Name Piped data
Number of rows 120
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
crepreqx 0 1 1.02 0.57 0.51 0.79 0.94 1.12 6.35 ▇▁▁▁▁
## Endocarditis
cardiovac %>%
  tabyl(endocarditispreqx)
##  endocarditispreqx   n    percent
##                  0 112 0.93333333
##                  1   8 0.06666667
####MANEJO QUIRURGICO
## Hipotermia
cardiovac %>%
  tabyl(tempintraop)
##  tempintraop  n    percent
##            0  4 0.03333333
##            1 72 0.60000000
##            2  4 0.03333333
##            3 40 0.33333333
## Hipotermia Profunda - Arresto Cardiaco
cardiovac %>%
  tabyl(hipotermiaprof)
##  hipotermiaprof  n   percent
##               0 95 0.7916667
##               1 25 0.2083333
### Tiempo de Isquemia
cardiovac %>%
  skim(tisquemia)
Data summary
Name Piped data
Number of rows 120
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
tisquemia 0 1 99.22 36.72 21 78 96.5 117.25 233 ▃▇▅▁▁
### Tiempo Circulacion Extracorporea
cardiovac %>%
  skim(tcextracorporea)
Data summary
Name Piped data
Number of rows 120
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
tcextracorporea 0 1 142.72 49.71 52 111 134 175.75 328 ▃▇▃▁▁
### Recibio Transfusiones durante Cirugia

cardiovac %>%
  tabyl(transfusionintraop)
##  transfusionintraop   n    percent
##                   0   5 0.04166667
##                   1 115 0.95833333
### Numero de Globulos Rojos Transfundidos IntraQX
cardiovac %>%
  filter(grintraop >= 1) %>%
  skim(grintraop)
Data summary
Name Piped data
Number of rows 93
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
grintraop 0 1 3.78 2.36 1 2 3 5 12 ▇▅▂▁▁
## Plasma Congelado Intraqx
cardiovac %>%
  filter(pfcintraop >= 1) %>%
  skim(pfcintraop)
Data summary
Name Piped data
Number of rows 96
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
pfcintraop 0 1 6.59 3.08 1 4 6 8 15 ▂▇▂▂▁
## Plaquetas Congelado Intraqx
cardiovac %>%
  filter(pltintraop >= 1) %>%
  skim(pltintraop)
Data summary
Name Piped data
Number of rows 103
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
pltintraop 0 1 1.56 0.88 1 1 1 2 5 ▇▃▁▁▁
## Crioprecipitado Congelado Intraqx
cardiovac %>%
  filter(criointraop >= 1) %>%
  skim(criointraop)
Data summary
Name Piped data
Number of rows 103
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
criointraop 0 1 10.63 4.75 3 8 10 12 30 ▇▇▃▁▁
#######################################
##### Post-QX

### Tiempo de Presion Negativa
cardiovac %>%
  skim(diasvac)
Data summary
Name Piped data
Number of rows 120
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
diasvac 0 1 2.26 2.16 1 1 2 3 23 ▇▁▁▁▁
### 3 o mas dias de terapia de presion negativa
cardiovac %>%
  mutate(tpn = ifelse(diasvac >= 3,1,0)) %>%
  tabyl(tpn)
##  tpn  n   percent
##    0 82 0.6833333
##    1 38 0.3166667
####### Sangrado en las primeras 12 h
cardiovac %>%
  skim(sangrado12h)
Data summary
Name Piped data
Number of rows 120
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
sangrado12h 0 1 735.03 399.88 100 400 650 1000 2110 ▇▆▃▂▁
####### Sangrado en  12 h a 24 h
cardiovac %>%
  skim(sangrado24h)
Data summary
Name Piped data
Number of rows 120
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
sangrado24h 0 1 248.49 154.83 0 147.5 200 300 954 ▆▇▂▁▁
#### Sangrado Total
cardiovac %>%
  mutate(sangradototal = sangrado12h + sangrado24h) %>%
  skim(sangradototal)
Data summary
Name Piped data
Number of rows 120
Number of columns 43
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
sangradototal 0 1 983.52 477.74 320 637.5 850 1225 2810 ▇▅▃▁▁
### Requirio Transfusiion Post-operatoria
cardiovac %>%
  tabyl(transfpop)
##  transfpop  n   percent
##          0 58 0.4833333
##          1 62 0.5166667
### Transfusiones Postoperatorias
## Globulos Rojos
cardiovac %>%
  filter(grpop >= 1) %>%
  skim(grpop)
Data summary
Name Piped data
Number of rows 56
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
grpop 0 1 3.02 2.22 1 2 2 4 13 ▇▂▁▁▁
### Plasma Fresco Congelado
cardiovac %>%
  filter(pfcpop >= 1) %>%
  skim(pfcpop)
Data summary
Name Piped data
Number of rows 27
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
pfcpop 0 1 5.22 3.65 1 2.5 4 8 14 ▇▇▅▁▂
### Plaquetas
cardiovac %>%
  filter(pltpop >= 1) %>%
  skim(pltpop)
Data summary
Name Piped data
Number of rows 29
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
pltpop 0 1 1.83 1.14 1 1 2 2 6 ▇▁▁▁▁
## Crioprecipitado

cardiovac %>%
  filter(criopop >= 1) %>%
  skim(criopop)
Data summary
Name Piped data
Number of rows 17
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
criopop 0 1 7.94 3.44 3 6 6 10 16 ▃▇▇▂▁
###############
#### RESULTADOS CLINICOS######

### Infeccion del Sitio Operatorio
cardiovac %>%
  tabyl(iso)
##  iso   n    percent
##    0 110 0.91666667
##    1  10 0.08333333
### Mediastinitis Postoperatoria
cardiovac %>%
  tabyl(mediastinitis)
##  mediastinitis   n    percent
##              0 110 0.91666667
##              1  10 0.08333333
### AKI-Postoperatoria
cardiovac %>%
  tabyl(akipop)
##  akipop  n percent
##       0 81   0.675
##       1 39   0.325
#### Estancia en UCI
cardiovac %>%
  skim(diasuci)
Data summary
Name Piped data
Number of rows 120
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
diasuci 0 1 10.38 9.17 1 6 8.5 12 74 ▇▁▁▁▁
#### Tiempo de Intubacion
cardiovac %>%
  skim(tintubacion)
Data summary
Name Piped data
Number of rows 120
Number of columns 42
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
tintubacion 0 1 4.53 2.94 1 2.75 4 6 21 ▇▂▁▁▁
### Necesidad de Reintervención
cardiovac %>%
  tabyl(reintervencion)
##  reintervencion  n   percent
##               0 95 0.7916667
##               1 25 0.2083333
### Mortalidad
cardiovac %>%
  tabyl(mortalidadintrahospitalaria)
##  mortalidadintrahospitalaria   n   percent
##                            0 100 0.8333333
##                            1  20 0.1666667