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)

volvulos <- read_excel("C:/Users/eyase/Downloads/volvulos.xlsx", 
                       sheet = "Volvulus SILS", col_types = c("numeric", 
                                                              "text", "numeric", "text", "text", 
                                                              "text", "text", "text", "text", "text", 
                                                              "text", "text", "text", "text", "text", 
                                                              "text", "text", "text", "text", "numeric", 
                                                              "numeric", "text", "text", "numeric"))


volvulos
## # A tibble: 24 x 24
##        n genero  edad dm2   hta   esquizofrenia deficitcog dolorabd distension
##    <dbl> <chr>  <dbl> <chr> <chr> <chr>         <chr>      <chr>    <chr>     
##  1    13 Mujer~    30 No    No    Sí            No         Sí       No        
##  2    17 Hombr~    29 No    No    Sí            No         No       No        
##  3    19 Mujer~    78 Sí    Sí    No            No         No       No        
##  4    21 Hombr~    74 No    Sí    No            No         Sí       No        
##  5     2 Mujer~    65 Sí    Sí    No            No         Sí       Sí        
##  6     6 Hombr~    18 No    No    Sí            No         Sí       No        
##  7     7 Hombr~    44 Sí    No    No            No         No       No        
##  8    10 Mujer~    55 No    No    No            Sí         Sí       No        
##  9     9 Mujer~    80 No    Sí    No            No         No       No        
## 10     1 Hombr~    38 No    No    Sí            No         Sí       No        
## # ... with 14 more rows, and 15 more variables: obstruccion <chr>,
## #   rxabdomen <chr>, tac <chr>, isquemia <chr>, devovulacion <chr>,
## #   tuboendoanal <chr>, cxtresdias <chr>, cxcincodias <chr>,
## #   anastomosistt <chr>, anastomosisll <chr>, tiempoqx <dbl>, sangrado <dbl>,
## #   complicaciones <chr>, fuganastomotica <chr>, estanciahospital <dbl>
names(volvulos)
##  [1] "n"                "genero"           "edad"             "dm2"             
##  [5] "hta"              "esquizofrenia"    "deficitcog"       "dolorabd"        
##  [9] "distension"       "obstruccion"      "rxabdomen"        "tac"             
## [13] "isquemia"         "devovulacion"     "tuboendoanal"     "cxtresdias"      
## [17] "cxcincodias"      "anastomosistt"    "anastomosisll"    "tiempoqx"        
## [21] "sangrado"         "complicaciones"   "fuganastomotica"  "estanciahospital"
###### Baseline Characteristics
volvulos %>%
  tabyl(genero)
##   genero  n   percent
##  Hombres 14 0.5833333
##  Mujeres 10 0.4166667
volvulos %>%
  skim(edad)
Data summary
Name Piped data
Number of rows 24
Number of columns 24
_______________________
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 46.83 17.12 18 34.5 43 58.25 80 ▃▇▅▃▃
volvulos %>%
  tabyl(dm2)
##  dm2  n   percent
##   No 20 0.8333333
##   Sí  4 0.1666667
volvulos %>%
  tabyl(hta)
##  hta  n   percent
##   No 16 0.6666667
##   Sí  8 0.3333333
volvulos %>%
  tabyl(esquizofrenia)
##  esquizofrenia  n   percent
##             No 17 0.7083333
##             Sí  7 0.2916667
volvulos %>%
  tabyl(deficitcog)
##  deficitcog  n percent
##          No 21   0.875
##          Sí  3   0.125
volvulos %>%
  tabyl(deficitcog)
##  deficitcog  n percent
##          No 21   0.875
##          Sí  3   0.125
volvulos %>%
  tabyl(dolorabd)
##  dolorabd  n percent
##        No 12     0.5
##        Sí 12     0.5
volvulos %>%
  tabyl(distension)
##  distension  n   percent
##          No 17 0.7083333
##          Sí  7 0.2916667
volvulos %>%
  tabyl(obstruccion)
##  obstruccion  n percent
##           No 15   0.625
##           Sí  9   0.375
volvulos %>%
  tabyl(rxabdomen)
##  rxabdomen  n percent
##         Sí 24       1
volvulos %>%
  tabyl(tac)
##  tac  n   percent
##   No 20 0.8333333
##   Sí  4 0.1666667
volvulos %>%
  tabyl(isquemia)
##  isquemia  n percent
##        No 24       1
volvulos %>%
  tabyl(devovulacion)
##  devovulacion  n percent
##            Sí 24       1
volvulos %>%
  tabyl(tuboendoanal)
##  tuboendoanal  n   percent
##            No 13 0.5416667
##            Sí 11 0.4583333
volvulos %>%
  tabyl(cxtresdias)
##  cxtresdias  n   percent
##          No 13 0.5416667
##          Sí 11 0.4583333
volvulos %>%
  tabyl(cxcincodias)
##  cxcincodias  n   percent
##           No 11 0.4583333
##           Sí 13 0.5416667
volvulos %>%
  tabyl(anastomosistt)
##  anastomosistt  n   percent
##             No 14 0.5833333
##             Sí 10 0.4166667
volvulos %>%
  tabyl(anastomosisll)
##  anastomosisll  n   percent
##             No 10 0.4166667
##             Sí 14 0.5833333
volvulos %>%
  skim(tiempoqx)
Data summary
Name Piped data
Number of rows 24
Number of columns 24
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
tiempoqx 0 1 131.25 32.88 90 112.5 120 150 180 ▆▇▁▅▅
volvulos %>%
  skim(sangrado)
Data summary
Name Piped data
Number of rows 24
Number of columns 24
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
sangrado 0 1 62.5 29.23 30 30 60 90 120 ▇▇▁▆▂
volvulos %>%
  tabyl(complicaciones)
##  complicaciones  n    percent
##              No 23 0.95833333
##              Sí  1 0.04166667
volvulos %>%
  tabyl(fuganastomotica)
##  fuganastomotica  n    percent
##               No 23 0.95833333
##               Sí  1 0.04166667
volvulos %>%
  skim(estanciahospital)
Data summary
Name Piped data
Number of rows 24
Number of columns 24
_______________________
Column type frequency:
numeric 1
________________________
Group variables

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
estanciahospital 0 1 4.58 3.08 3 3 3 5 17 ▇▂▁▁▁
#### TIPO DE ANASTOMOSIS
volvulos %>%
  tabyl(genero, anastomosistt) %>%
adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##          anastomosistt                     
##   genero            No        Sí      Total
##  Hombres     6 (42.9%) 8 (80.0%) 14 (58.3%)
##  Mujeres     8 (57.1%) 2 (20.0%) 10 (41.7%)
volvulos %>%
  tabyl(genero, anastomosistt) %>%
  chisq.test()
## Warning in stats::chisq.test(., ...): Chi-squared approximation may be incorrect
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  .
## X-squared = 1.9592, df = 1, p-value = 0.1616
volvulos %>%
  group_by(anastomosistt) %>%
  skim(edad)
Data summary
Name Piped data
Number of rows 24
Number of columns 24
_______________________
Column type frequency:
numeric 1
________________________
Group variables anastomosistt

Variable type: numeric

skim_variable anastomosistt n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
edad No 0 1 45.57 14.77 22 38.75 43.0 53 80 ▃▇▃▁▁
edad 0 1 48.60 20.69 18 33.50 44.5 65 78 ▅▇▂▅▅
with(data = volvulos, wilcox.test(edad ~ anastomosistt))
## Warning in wilcox.test.default(x = c(30, 65, 44, 55, 80, 38, 41, 56, 22, :
## cannot compute exact p-value with ties
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  edad by anastomosistt
## W = 67.5, p-value = 0.9066
## alternative hypothesis: true location shift is not equal to 0
volvulos %>%
  tabyl(dm2, anastomosistt) %>%
  adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##      anastomosistt                     
##  dm2            No        Sí      Total
##   No    11 (78.6%) 9 (90.0%) 20 (83.3%)
##   Sí     3 (21.4%) 1 (10.0%)  4 (16.7%)
volvulos %>%
  tabyl(genero, anastomosistt) %>%
  fisher.test()
## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 0.1041
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.0153816 1.5585265
## sample estimates:
## odds ratio 
##  0.2017943
volvulos %>%
  tabyl(hta, anastomosistt) %>%
  adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##      anastomosistt                     
##  hta            No        Sí      Total
##   No     9 (64.3%) 7 (70.0%) 16 (66.7%)
##   Sí     5 (35.7%) 3 (30.0%)  8 (33.3%)
volvulos %>%
  tabyl(hta, anastomosistt) %>%
  fisher.test()
## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.08894922 5.81813753
## sample estimates:
## odds ratio 
##  0.7797679
volvulos %>%
  tabyl(esquizofrenia, anastomosistt) %>%
  adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##                anastomosistt                     
##  esquizofrenia            No        Sí      Total
##             No    11 (78.6%) 6 (60.0%) 17 (70.8%)
##             Sí     3 (21.4%) 4 (40.0%)  7 (29.2%)
volvulos %>%
  tabyl(esquizofrenia, anastomosistt) %>%
  fisher.test()
## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 0.3926
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.2883631 21.9874807
## sample estimates:
## odds ratio 
##    2.35086
volvulos %>%
  tabyl(deficitcog, anastomosistt) %>%
  adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##             anastomosistt                     
##  deficitcog            No        Sí      Total
##          No    12 (85.7%) 9 (90.0%) 21 (87.5%)
##          Sí     2 (14.3%) 1 (10.0%)  3 (12.5%)
volvulos %>%
  tabyl(deficitcog, anastomosistt) %>%
  fisher.test()
## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.01019117 14.99701641
## sample estimates:
## odds ratio 
##  0.6776633
volvulos %>%
  tabyl(dolorabd, anastomosistt) %>%
  adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##           anastomosistt                     
##  dolorabd            No        Sí      Total
##        No     4 (28.6%) 8 (80.0%) 12 (50.0%)
##        Sí    10 (71.4%) 2 (20.0%) 12 (50.0%)
volvulos %>%
  tabyl(dolorabd, anastomosistt) %>%
  fisher.test()
## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 0.03607
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.008101526 0.896925044
## sample estimates:
## odds ratio 
##  0.1121872
volvulos %>%
  tabyl(distension, anastomosistt) %>%
  adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##             anastomosistt                     
##  distension            No        Sí      Total
##          No    10 (71.4%) 7 (70.0%) 17 (70.8%)
##          Sí     4 (28.6%) 3 (30.0%)  7 (29.2%)
volvulos %>%
  tabyl(distension, anastomosistt) %>%
  fisher.test()
## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.1175924 8.7547429
## sample estimates:
## odds ratio 
##   1.068345
volvulos %>%
  tabyl(tuboendoanal, anastomosistt) %>%
  adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##               anastomosistt                     
##  tuboendoanal            No        Sí      Total
##            No     8 (57.1%) 5 (50.0%) 13 (54.2%)
##            Sí     6 (42.9%) 5 (50.0%) 11 (45.8%)
volvulos %>%
  tabyl(tuboendoanal, anastomosistt) %>%
  fisher.test()
## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.1963085 9.0577124
## sample estimates:
## odds ratio 
##   1.317346
volvulos %>%
  tabyl(cxtresdias, anastomosistt) %>%
  adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##             anastomosistt                     
##  cxtresdias            No        Sí      Total
##          No     9 (64.3%) 4 (40.0%) 13 (54.2%)
##          Sí     5 (35.7%) 6 (60.0%) 11 (45.8%)
volvulos %>%
  tabyl(cxtresdias, anastomosistt) %>%
  fisher.test()
## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 0.4081
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.3866882 19.7763559
## sample estimates:
## odds ratio 
##   2.585674
volvulos %>%
  tabyl(cxcincodias, anastomosistt) %>%
  adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##              anastomosistt                     
##  cxcincodias            No        Sí      Total
##           No     5 (35.7%) 6 (60.0%) 11 (45.8%)
##           Sí     9 (64.3%) 4 (40.0%) 13 (54.2%)
volvulos %>%
  tabyl(cxtresdias, anastomosistt) %>%
  fisher.test()
## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 0.4081
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.3866882 19.7763559
## sample estimates:
## odds ratio 
##   2.585674
volvulos %>%
  tabyl(complicaciones, anastomosistt) %>%
  adorn_totals(c("col")) %>%
  adorn_percentages(denominator = "col") %>%
  adorn_pct_formatting() %>%
  adorn_ns(position = "front") %>%
  adorn_title() 
##                 anastomosistt                       
##  complicaciones            No          Sí      Total
##              No    13 (92.9%) 10 (100.0%) 23 (95.8%)
##              Sí     1  (7.1%)  0   (0.0%)  1  (4.2%)
volvulos %>%
  tabyl(complicaciones, anastomosistt) %>%
  fisher.test()
## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.00000 54.55431
## sample estimates:
## odds ratio 
##          0
volvulos %>%
  group_by(anastomosistt) %>%
  skim(estanciahospital)
Data summary
Name Piped data
Number of rows 24
Number of columns 24
_______________________
Column type frequency:
numeric 1
________________________
Group variables anastomosistt

Variable type: numeric

skim_variable anastomosistt n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
estanciahospital No 0 1 4.29 3.73 3 3 3 3.00 17 ▇▁▁▁▁
estanciahospital 0 1 5.00 1.94 3 3 5 6.75 8 ▇▃▂▃▂
wilcox.test( estanciahospital ~ anastomosistt, data = volvulos)
## Warning in wilcox.test.default(x = c(3, 3, 3, 17, 5, 3, 3, 3, 3, 3, 3, 5, :
## cannot compute exact p-value with ties
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  estanciahospital by anastomosistt
## W = 42, p-value = 0.06328
## alternative hypothesis: true location shift is not equal to 0