R Markdown
ggplot(data = cole, aes(x = sexo))+
geom_bar()

table(cole$sexo)
##
## 0 1
## 185 82
ggplot(data = cole, aes(x = edad))+
geom_histogram()+
geom_density()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

summary(cole$edad)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 18.00 39.00 57.00 55.54 72.00 90.00
table(cole$procedencia)
##
## 0 1
## 111 156
ggplot(data = cole, aes(x = cole$time_evolution))+
geom_bar()

table(cole$ictericia)
##
## 0 1
## 196 71
table(cole$emesis)
##
## 0 1
## 120 147
table(cole$murphy)####que es esto??
##
## 0 1 2
## 186 75 6
table(cole$dolor_csd)
##
## 0 1
## 9 258
prop.table(table(cole$fiebre))
##
## 0 1
## 0.94756554 0.05243446
table(cole$dm2)
##
## 0 1
## 239 28
table(cole$hta)
##
## 0 1
## 193 74
table(cole$epoc)
##
## 0 1
## 251 16
table(cole$cancer_hepatico)
##
## 0 1
## 265 2
table(cole$cirrosis_hepatica)
##
## 0
## 267
ggplot(data = cole, aes(x = wbc))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data = cole, aes(x = cole$neutrofilos))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data = cole, aes(x = cole$alt_tgp))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 10 rows containing non-finite values (stat_bin).

cole$alt_tgp <- as.numeric(cole$alt_tgp)
ggplot(data = cole, aes(x = cole$alt_tgp))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 10 rows containing non-finite values (stat_bin).

cole$ast_tgo <- as.numeric(cole$ast_tgo)
ggplot(data = cole, aes(x = cole$ast_tgo))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 10 rows containing non-finite values (stat_bin).

cole$amilasa <- as.numeric(cole$amilasa)
ggplot(data = cole, aes(x = cole$amilasa))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 26 rows containing non-finite values (stat_bin).

cole$bilirrubina_total <- as.numeric(cole$bilirrubina_total)
ggplot(data = cole, aes(x = cole$bilirrubina_total))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 2 rows containing non-finite values (stat_bin).

cole$bilirrubina_indirecta <- as.numeric(cole$bilirrubina_indirecta)
summary(cole$bilirrubina_indirecta)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.0300 0.2975 0.5000 0.8039 0.9050 8.0000 3
ggplot(data = cole, aes(x = cole$bilirrubina_indirecta))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 3 rows containing non-finite values (stat_bin).

cole$bilirrubina_directa <- as.numeric(cole$bilirrubina_directa)
## Warning: NAs introduced by coercion
summary(cole$bilirrubina_directa)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.0100 0.4975 1.1750 2.2701 3.0925 23.4600 3
ggplot(data = cole, aes(x = cole$bilirrubina_directa))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 3 rows containing non-finite values (stat_bin).

cole$ptt <- as.numeric(cole$ptt)
## Warning: NAs introduced by coercion
summary(cole$ptt)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 26.00 33.00 35.00 36.08 38.00 58.30 145
ggplot(data = cole, aes(x = cole$ptt))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 145 rows containing non-finite values (stat_bin).

cole$pt <- as.numeric(cole$pt)
## Warning: NAs introduced by coercion
summary(cole$pt)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 12.00 13.00 13.65 14.38 14.47 41.00 141
ggplot(data = cole, aes(x = cole$pt))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 141 rows containing non-finite values (stat_bin).

cole$pcr <- as.numeric(cole$pcr)
## Warning: NAs introduced by coercion
summary(cole$pcr)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.040 0.700 2.260 8.409 10.970 250.000 53
ggplot(data = cole, aes(x = cole$pcr))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 53 rows containing non-finite values (stat_bin).

cole$`fosfatasa alcalina` <- as.numeric(cole$`fosfatasa alcalina`)
## Warning: NAs introduced by coercion
summary(cole$`fosfatasa alcalina`)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 17.2 132.0 205.0 267.9 315.2 1677.0 13
ggplot(data = cole, aes(x = cole$`fosfatasa alcalina`))+
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 13 rows containing non-finite values (stat_bin).

cole$eco_colecistitis <- cole$colecistitis...33 #####Que es esta variable?
table(cole$eco_colecistitis)
##
## 0 1
## 125 140
table(cole$colelitiasis...34)
##
## 0 1
## 41 226
table(cole$coledocolitiasis...35)
##
## 0 1
## 257 10
table(cole$tumor)
##
## 0 1
## 265 2
cole$dila_biliar <- as.numeric(cole$`dilatacion_coledoco_(mm)_eco`)
## Warning: NAs introduced by coercion
summary(cole$dila_biliar)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 2 4 8 8604 12 43716 120
##########Analysis
cole$colecistitis...33 <- as.factor(cole$colecistitis...33)
ggplot(data = cole, aes(x = cole$alt_tgp))+
geom_histogram()+
facet_wrap(~ cole$colecistitis...33)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 10 rows containing non-finite values (stat_bin).

colecistis <- filter(cole, cole$colecistitis_aguda == 1)
colecistis <- colecistis %>%
mutate(alt_high = alt_tgp > 100)
colecistis <- colecistis %>%
mutate(ast_high = ast_tgo > 100)
colecistis <- colecistis %>%
mutate(fosfatasa_high = `fosfatasa alcalina` > 100)
colecistis <- colecistis %>%
mutate(bilirrubina_high = bilirrubina_total > 1.5 & bilirrubina_total <4 )
length(colecistis$edad)
## [1] 146
draft1 <- filter(colecistis, colecistis$riesgo_calculado == 2)
table(draft1$alt_high)
##
## FALSE TRUE
## 9 33
table(draft1$ast_high)
##
## FALSE TRUE
## 11 32
table(draft1$bilirrubina_high)
##
## FALSE TRUE
## 31 12
table(draft1$fosfatasa_high)
##
## FALSE TRUE
## 2 38
table(draft1$alt_high, draft1$crmn)
##
## 0 1
## FALSE 6 3
## TRUE 18 15
table(draft1$ast_high, draft1$crmn)
##
## 0 1
## FALSE 9 2
## TRUE 15 17
table(draft1$alt_high, draft1$crmn)
##
## 0 1
## FALSE 6 3
## TRUE 18 15
table(draft1$alt_high, draft1$crmn)
##
## 0 1
## FALSE 6 3
## TRUE 18 15