Hispanic/ethnicity
All Races All etiologies (everything that is not UNC is other)
-UNC categories are Congenital hydrocephalus Intraventricular hemorrhage (IVH) or prematurity or without cause, Neoplastic Post infectious , Post Traumatic , Spin bifida with Chiari malformation/myelomenigocele Syndromic, not otherwise specified -ONLY include prior procedure in Premie IVH table -premature birth is YES/NO (less than 37 weeks)

redoing this with the new csv hannah made

df <- read.csv("shunt_figures_data.csv", header = TRUE)
df$Race[df$Race=="Asian\nWhite or Caucasian"] <- "Mixed/Other Race"
df$Race[df$Race=="White or Caucasian\nOther Race"] <- "Mixed/Other Race"
df$Race[df$Race=="White or Caucasian\nAmerican Indian or Alaska Native"] <- "Mixed/Other Race"
df$Race[df$Race=="White or Caucasian\nAsian"] <- "Mixed/Other Race"
df$Race[df$Race=="Other Race"] <- "Mixed/Other Race"
df$Race[df$Race == "Black or African American\nWhite or Caucasian\nUnknown\nOther Race"] <- "Mixed/Other Race"
df$Race[df$Race == "Other Race\nBlack or African American"] <- "Mixed/Other Race"
df$Race[df$Race == "Other Race"] <- "Mixed/Other Race"
df$Race[df$Race == "White or Caucasian\nAsian\nNative Hawaiian or Other Pacific Islander"] <- "Mixed/Other Race"

df[df == "Hispanic/Latino"] <- "Hispanic or Latino"

#table(df$Race)
df %>%
  select(2:8,9:12,14) %>%
  tbl_summary(
    digits = all_continuous() ~ 2,
    missing_text = "(Missing)"
  )%>%
  modify_header(all_stat_cols() ~ "**{level}**<br>N = {n} ({style_percent(p)}%)") %>%
  bold_labels() %>%
  #modify_caption("****")%>%
  modify_caption("<div style='text-align: left; color: grey'> Table 1. UNC Patient Characteristics</div>")
Table 1. UNC Patient Characteristics
Characteristic Overall
N = 135 (100%)1
Sex
    F 59 (44%)
    M 76 (56%)
GA.at.Delivery.in.Weeks 37.00 (30.50, 39.00)
PREMATURE..True.False..true.premature. 82 (61%)
GA.at.Delivery.in.Days 259.00 (213.50, 273.00)
Race
    American Indian or Alaska Native 3 (2.2%)
    Asian 2 (1.5%)
    Black or African American 33 (24%)
    Mixed/Other Race 31 (23%)
    White or Caucasian 66 (49%)
Hispanic.Latino
    Hispanic or Latino 25 (19%)
    Not Hispanic or Latino 110 (81%)
Failure.within.first.year.after.surgery
    n 78 (58%)
    y 57 (42%)
Days.Until.First.failure 78.50 (26.00, 425.00)
    (Missing) 55
Chronological.Age.at.First.Shunt..in.days. 84.00 (24.00, 170.50)
Gestational.Age.at.First.Shunt..in.Days. 319.00 (278.00, 411.00)
Number.of.CSF.diverting.temporizing.surgeries
    0 35 (55%)
    1 19 (30%)
    2 5 (7.8%)
    3 5 (7.8%)
    (Missing) 71
Hydro.Etiology.Categorized
    Congenital hydrocephalus 40 (30%)
    Intraventricular hemorrhage (IVH) or prematurity or without cause 35 (26%)
    Neoplastic 5 (3.7%)
    Post infectious 4 (3.0%)
    Post Traumatic 1 (0.7%)
    Spina bifida with Chiari malformation/myelomenigocele 45 (33%)
    Syndromic, not otherwise specified 5 (3.7%)
1 n (%); Median (IQR)

IVH TABLE

df %>%
  select(2:8,9:12,14) %>%
  filter(Hydro.Etiology.Categorized == "Intraventricular hemorrhage (IVH) or prematurity or without cause ") %>%
  tbl_summary(
    digits = all_continuous() ~ 2,
    missing_text = "(Missing)"
  )%>%
  modify_header(all_stat_cols() ~ "**{level}**<br>N = {n} ({style_percent(p)}%)") %>%
  bold_labels() %>%
  #modify_caption("****")%>%
  modify_caption("<div style='text-align: left; color: grey'> Table 2. UNC IVH patients characteristics </div>")
Table 2. UNC IVH patients characteristics
Characteristic Overall
N = 35 (100%)1
Sex
    F 14 (40%)
    M 21 (60%)
GA.at.Delivery.in.Weeks 27.43 (24.93, 30.64)
PREMATURE..True.False..true.premature. 33 (94%)
GA.at.Delivery.in.Days 192.00 (174.50, 214.50)
Race
    Asian 1 (2.9%)
    Black or African American 10 (29%)
    Mixed/Other Race 10 (29%)
    White or Caucasian 14 (40%)
Hispanic.Latino
    Hispanic or Latino 5 (14%)
    Not Hispanic or Latino 30 (86%)
Failure.within.first.year.after.surgery
    n 17 (49%)
    y 18 (51%)
Days.Until.First.failure 50.50 (18.50, 593.00)
    (Missing) 9
Chronological.Age.at.First.Shunt..in.days. 97.00 (69.50, 150.00)
Gestational.Age.at.First.Shunt..in.Days. 294.00 (264.50, 326.50)
Number.of.CSF.diverting.temporizing.surgeries
    0 11 (44%)
    1 7 (28%)
    2 3 (12%)
    3 4 (16%)
    (Missing) 10
Hydro.Etiology.Categorized
    Intraventricular hemorrhage (IVH) or prematurity or without cause 35 (100%)
1 n (%); Median (IQR)