Peanut Project

list.files()
##  [1] "AdultFoodAllergyCorr-PeanutAllergy_DATA_2026-04-15_1404.csv"              
##  [2] "AdultFoodAllergyCorr-PeanutAllergy_DATA_2026-04-29_1223.csv"              
##  [3] "AdultFoodAllergyCorr-PeanutAllergy_DATA_LABELS_2026-04-15_1403.csv"       
##  [4] "AdultFoodAllergyCorr-PeanutAllergy_DATA_LABELS_2026-04-29_1223.csv"       
##  [5] "AdultFoodAllergyCorr-PeanutAllergy_R_2026-04-15_1404.r"                   
##  [6] "AdultFoodAllergyCorr-ShellfishTrueAllergy_DATA_LABELS_2024-04-30_0948.csv"
##  [7] "AdultFoodAllergyCorr-ShellfishTrueAllergy_DATA_LABELS_2024-05-30_0822.csv"
##  [8] "AdultFoodAllergyCorr-ShellfishTrueAllergy_DATA_LABELS_2024-06-02_1910.csv"
##  [9] "AdultFoodAllergyCorr-ShellfishTrueAllergy_DATA_LABELS_2024-06-10_0733.csv"
## [10] "Black Chalkboard First Day of School Board.png"                           
## [11] "filtereddata.csv"                                                         
## [12] "Food Allergy Action Plan.PDF"                                             
## [13] "JU_Robinson_Report_NME (1).docx"                                          
## [14] "JU_Robinson_Report_NME.docx"                                              
## [15] "NEWAIDATA.csv"                                                            
## [16] "NEWOMAR_6224.html"                                                        
## [17] "NEWOMAR_6224.Rmd"                                                         
## [18] "NEWOMAR_files"                                                            
## [19] "NEWOMAR.html"                                                             
## [20] "NEWOMAR.Rmd"                                                              
## [21] "NJ_ScoreSummary_5.23.24.xlsx"                                             
## [22] "OMarAI"                                                                   
## [23] "omarai.csv"                                                               
## [24] "OMarAI.Rproj"                                                             
## [25] "omarai2.csv"                                                              
## [26] "Omarallergy.csv"                                                          
## [27] "PeanutProject.html"                                                       
## [28] "PeanutProject.Rmd"                                                        
## [29] "Redic_ClientReport_NJ_5.30.docx"                                          
## [30] "Redic_ClientReport_NJ_NME.docx"                                           
## [31] "rsconnect"                                                                
## [32] "tmp-pdfcrop-61138.tex"
datanew2026 <- read.csv('AdultFoodAllergyCorr-PeanutAllergy_DATA_LABELS_2026-04-29_1223.csv')

View(datanew2026)

datanew2026_filtered <- datanew2026 %>%
  filter(
    peanut.total.IgE >= 0.35 |
    Peanut.skin.test.interpretation == "positive"
  )

#Setting Labels



##changing the variable names for ease
names(datanew2026)<- gsub("age_group..ethnicity..choice.", "", names(datanew2026))

names(datanew2026_filtered)<- gsub("peanut.that.the.patient.reacted.to..or.suspected.reacted.to...choice.", "", names(datanew2026_filtered))

datanew2026[][datanew2026[] == "Checked"] <- 1

datanew2026[][datanew2026[] == "Unchecked"] <- 0

First step, make age_group categories

#col_names <- colnames(datanew2026_filtered)
#duplicate_cols <- col_names[duplicated(col_names)]

table(datanew2026_filtered$peanut.age.of.allergy.onset)
## 
##  1  2  3  4  5  6  7  9 10 11 12 13 17 18 21 22 23 26 27 30 33 38 45 46 53 54 
## 25 16  5  5  2  1  2  3  1  1  3  2  1  1  1  1  1  1  1  1  1  1  1  1  3  1
table(datanew2026_filtered$peanut.age.of.allergy.onset.multiple.choice..if.specific.age.is.not.known.)
## 
##           adulthood childhood   unknown 
##        82         4        54        38

Categorize different age groups (adult vs. child)

describe(datanew2026_filtered$age.in.years)
colnames(datanew2026_filtered)
##  [1] "Record.ID"                                                                                                                                                                                                            
##  [2] "age.in.years"                                                                                                                                                                                                         
##  [3] "Sex"                                                                                                                                                                                                                  
##  [4] "Race..ethnicity..choice.White."                                                                                                                                                                                       
##  [5] "Race..ethnicity..choice.Black.or.African.American."                                                                                                                                                                   
##  [6] "Race..ethnicity..choice.American.Indian.or.Alaska.Native."                                                                                                                                                            
##  [7] "Race..ethnicity..choice.Asian."                                                                                                                                                                                       
##  [8] "Race..ethnicity..choice.Native.Hawaiian.or.Other.Pacific.Islander."                                                                                                                                                   
##  [9] "Race..ethnicity..choice.not.documented."                                                                                                                                                                              
## [10] "Race..ethnicity..choice.other."                                                                                                                                                                                       
## [11] "Race..ethnicity..choice.not.documented..1"                                                                                                                                                                            
## [12] "Food.allergy..choice.peanut."                                                                                                                                                                                         
## [13] "Food.allergy..choice.tree.nut."                                                                                                                                                                                       
## [14] "Food.allergy..choice.fish."                                                                                                                                                                                           
## [15] "Food.allergy..choice.shellfish."                                                                                                                                                                                      
## [16] "Food.allergy..choice.milk."                                                                                                                                                                                           
## [17] "Food.allergy..choice.egg."                                                                                                                                                                                            
## [18] "Food.allergy..choice.soy."                                                                                                                                                                                            
## [19] "Food.allergy..choice.wheat."                                                                                                                                                                                          
## [20] "Food.allergy..choice.sesame."                                                                                                                                                                                         
## [21] "family.history.of.food.allergy.or.other.atopy..asthma..eczema..allergic.rhinitis."                                                                                                                                    
## [22] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.allergic.rhinitis."                                                                                                                             
## [23] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.asthma."                                                                                                                                        
## [24] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.eczema."                                                                                                                                        
## [25] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.contact.dermatitis."                                                                                                                            
## [26] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.oral.allergy.syndrome."                                                                                                                         
## [27] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.anxiety."                                                                                                                                       
## [28] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.other.psychological.diagnosis..depression..bipolar..schizophrenia..etc.."                                                                       
## [29] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.cardiac..hypertension..coronary.artery.dz..etc.."                                                                                               
## [30] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.gastrointestinal."                                                                                                                              
## [31] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.alpha.gal.allergy."                                                                                                                             
## [32] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.other.food.allergy."                                                                                                                            
## [33] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.drug.allergy."                                                                                                                                  
## [34] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.stinging.insect.allergy..hymenoptera.."                                                                                                         
## [35] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.none.of.the.above."                                                                                                                             
## [36] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.not.documented."                                                                                                                                
## [37] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.birch."                                                                                                                                              
## [38] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.other.trees."                                                                                                                                        
## [39] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.grass."                                                                                                                                              
## [40] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.weeds."                                                                                                                                              
## [41] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.dust.mite."                                                                                                                                          
## [42] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.mold."                                                                                                                                               
## [43] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.no.testing.performed..information.not.available."                                                                                                    
## [44] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.cockroach."                                                                                                                                          
## [45] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.birch."                                                                                                                                 
## [46] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.other.trees."                                                                                                                           
## [47] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.grass."                                                                                                                                 
## [48] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.weeds."                                                                                                                                 
## [49] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.dust.mite."                                                                                                                             
## [50] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.mold."                                                                                                                                  
## [51] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.no.testing.performed..information.not.available."                                                                                       
## [52] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.cockroach."                                                                                                                             
## [53] "gastrointestinal.comorbidities...choice.IBD..crohns..ulcerative.colitis.."                                                                                                                                            
## [54] "gastrointestinal.comorbidities...choice.irritable.bowel.syndrome."                                                                                                                                                    
## [55] "gastrointestinal.comorbidities...choice.GERD."                                                                                                                                                                        
## [56] "gastrointestinal.comorbidities...choice.eosinophilic.gastrointestinal.disorders..ie..EoE.."                                                                                                                           
## [57] "gastrointestinal.comorbidities...choice.Hx.of.abdominal.surgery."                                                                                                                                                     
## [58] "gastrointestinal.comorbidities...choice.another.GI.diagnosis.not.otherwise.specified."                                                                                                                                
## [59] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.proton.pump.inhibitor."                                                                                                                    
## [60] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.beta.blocker."                                                                                                                             
## [61] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.ACE.ARB."                                                                                                                                  
## [62] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.NSAID..prescribed.or.documented.in.note.."                                                                                                 
## [63] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.sulfasalazine..azulfidine..or.mesalamine..5.ASA.."                                                                                         
## [64] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.immune.modulator..immune.suppressant..biologic..cyclophsophamide..MMF..calcineurin.inhibitor..mTOR.inhibitor..methotrexate..azathioprene.."
## [65] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.daily.oral.steroid."                                                                                                                       
## [66] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.none.of.the.above."                                                                                                                        
## [67] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.not.documented."                                                                                                                           
## [68] "prescribed.epinephrine.at.time.of.food.allergy.diagnosis"                                                                                                                                                             
## [69] "works.in.food.service.or.other.occupational.food.handling..chef..catering..fast.food..butcher..fishmonger..etc.."                                                                                                     
## [70] "works.in.an.occupation.with.chemicals.or.other.sensitizers..carpenter..painter..woodworker..lab.tech.or.researcher..firefighter..military..miner..etc.."                                                              
## [71] "Has.this.patient.ever.been.on.OIT..oral.immunotherapy..for.a.food.allergy"                                                                                                                                            
## [72] "peanut.total.IgE"                                                                                                                                                                                                     
## [73] "peanut.component.1.IgE"                                                                                                                                                                                               
## [74] "peanut.component.2.IgE"                                                                                                                                                                                               
## [75] "peanut.component.3.IgE"                                                                                                                                                                                               
## [76] "peanut.component.6.IgE"                                                                                                                                                                                               
## [77] "peanut.component.8.IgE"                                                                                                                                                                                               
## [78] "peanut.component.9.IgE"                                                                                                                                                                                               
## [79] "peanut.skin.test.wheal.size.average"                                                                                                                                                                                  
## [80] "Peanut.skin.test.interpretation"                                                                                                                                                                                      
## [81] "peanut.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema.."                                                                                                                                          
## [82] "peanut.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea.."                                                                                                                                  
## [83] "peanut.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath.."                                                                                               
## [84] "peanut.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness.."                                                                                                             
## [85] "peanut.symptoms.with.any.prior.reaction..choice.Neurologic..headache..parasthesias.."                                                                                                                                 
## [86] "peanut.symptoms.with.any.prior.reaction..choice.Other."                                                                                                                                                               
## [87] "peanut.symptoms.with.any.prior.reaction..choice.not.documented."                                                                                                                                                      
## [88] "peanut.other.symptom.description"                                                                                                                                                                                     
## [89] "peanut.severity.of.any.prior.reaction..choice.no.treatment.or.antihistamine.only."                                                                                                                                    
## [90] "peanut.severity.of.any.prior.reaction..choice.presented.to.ED.and..or.epinephrine.use."                                                                                                                               
## [91] "peanut.severity.of.any.prior.reaction..choice.not.documented."                                                                                                                                                        
## [92] "peanut.age.of.allergy.onset"                                                                                                                                                                                          
## [93] "peanut.clinical.course"                                                                                                                                                                                               
## [94] "peanut.age.of.allergy.onset.multiple.choice..if.specific.age.is.not.known."
datanew2026_filtered <- datanew2026_filtered %>%
  mutate(age_group = case_when(
    peanut.age.of.allergy.onset >= 18 |
    peanut.age.of.allergy.onset.multiple.choice..if.specific.age.is.not.known. == "adulthood" ~ "adult",

    peanut.age.of.allergy.onset < 18 |
    peanut.age.of.allergy.onset.multiple.choice..if.specific.age.is.not.known. == "childhood" ~ "child",

    TRUE ~ "unknown"
  ))

table(datanew2026_filtered$age_group)
## 
##   adult   child unknown 
##      19     121      38
filtered_data <- datanew2026_filtered %>%
  filter(age_group != 'unknown')


z <- table(filtered_data$age_group)
rownames(z) <- c( "Adult","Child")


kbl(z) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Var1 Freq
Adult 19
Child 121
colnames(datanew2026_filtered)
##  [1] "Record.ID"                                                                                                                                                                                                            
##  [2] "age.in.years"                                                                                                                                                                                                         
##  [3] "Sex"                                                                                                                                                                                                                  
##  [4] "Race..ethnicity..choice.White."                                                                                                                                                                                       
##  [5] "Race..ethnicity..choice.Black.or.African.American."                                                                                                                                                                   
##  [6] "Race..ethnicity..choice.American.Indian.or.Alaska.Native."                                                                                                                                                            
##  [7] "Race..ethnicity..choice.Asian."                                                                                                                                                                                       
##  [8] "Race..ethnicity..choice.Native.Hawaiian.or.Other.Pacific.Islander."                                                                                                                                                   
##  [9] "Race..ethnicity..choice.not.documented."                                                                                                                                                                              
## [10] "Race..ethnicity..choice.other."                                                                                                                                                                                       
## [11] "Race..ethnicity..choice.not.documented..1"                                                                                                                                                                            
## [12] "Food.allergy..choice.peanut."                                                                                                                                                                                         
## [13] "Food.allergy..choice.tree.nut."                                                                                                                                                                                       
## [14] "Food.allergy..choice.fish."                                                                                                                                                                                           
## [15] "Food.allergy..choice.shellfish."                                                                                                                                                                                      
## [16] "Food.allergy..choice.milk."                                                                                                                                                                                           
## [17] "Food.allergy..choice.egg."                                                                                                                                                                                            
## [18] "Food.allergy..choice.soy."                                                                                                                                                                                            
## [19] "Food.allergy..choice.wheat."                                                                                                                                                                                          
## [20] "Food.allergy..choice.sesame."                                                                                                                                                                                         
## [21] "family.history.of.food.allergy.or.other.atopy..asthma..eczema..allergic.rhinitis."                                                                                                                                    
## [22] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.allergic.rhinitis."                                                                                                                             
## [23] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.asthma."                                                                                                                                        
## [24] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.eczema."                                                                                                                                        
## [25] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.contact.dermatitis."                                                                                                                            
## [26] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.oral.allergy.syndrome."                                                                                                                         
## [27] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.anxiety."                                                                                                                                       
## [28] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.other.psychological.diagnosis..depression..bipolar..schizophrenia..etc.."                                                                       
## [29] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.cardiac..hypertension..coronary.artery.dz..etc.."                                                                                               
## [30] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.gastrointestinal."                                                                                                                              
## [31] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.alpha.gal.allergy."                                                                                                                             
## [32] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.other.food.allergy."                                                                                                                            
## [33] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.drug.allergy."                                                                                                                                  
## [34] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.stinging.insect.allergy..hymenoptera.."                                                                                                         
## [35] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.none.of.the.above."                                                                                                                             
## [36] "medical.comorbidities.documented.at.the.time.of.chart.review...choice.not.documented."                                                                                                                                
## [37] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.birch."                                                                                                                                              
## [38] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.other.trees."                                                                                                                                        
## [39] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.grass."                                                                                                                                              
## [40] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.weeds."                                                                                                                                              
## [41] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.dust.mite."                                                                                                                                          
## [42] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.mold."                                                                                                                                               
## [43] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.no.testing.performed..information.not.available."                                                                                                    
## [44] "rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.cockroach."                                                                                                                                          
## [45] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.birch."                                                                                                                                 
## [46] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.other.trees."                                                                                                                           
## [47] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.grass."                                                                                                                                 
## [48] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.weeds."                                                                                                                                 
## [49] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.dust.mite."                                                                                                                             
## [50] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.mold."                                                                                                                                  
## [51] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.no.testing.performed..information.not.available."                                                                                       
## [52] "oral.allergy.syndrome.specific.sensitization..skin.test.or.serum.IgE...choice.cockroach."                                                                                                                             
## [53] "gastrointestinal.comorbidities...choice.IBD..crohns..ulcerative.colitis.."                                                                                                                                            
## [54] "gastrointestinal.comorbidities...choice.irritable.bowel.syndrome."                                                                                                                                                    
## [55] "gastrointestinal.comorbidities...choice.GERD."                                                                                                                                                                        
## [56] "gastrointestinal.comorbidities...choice.eosinophilic.gastrointestinal.disorders..ie..EoE.."                                                                                                                           
## [57] "gastrointestinal.comorbidities...choice.Hx.of.abdominal.surgery."                                                                                                                                                     
## [58] "gastrointestinal.comorbidities...choice.another.GI.diagnosis.not.otherwise.specified."                                                                                                                                
## [59] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.proton.pump.inhibitor."                                                                                                                    
## [60] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.beta.blocker."                                                                                                                             
## [61] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.ACE.ARB."                                                                                                                                  
## [62] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.NSAID..prescribed.or.documented.in.note.."                                                                                                 
## [63] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.sulfasalazine..azulfidine..or.mesalamine..5.ASA.."                                                                                         
## [64] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.immune.modulator..immune.suppressant..biologic..cyclophsophamide..MMF..calcineurin.inhibitor..mTOR.inhibitor..methotrexate..azathioprene.."
## [65] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.daily.oral.steroid."                                                                                                                       
## [66] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.none.of.the.above."                                                                                                                        
## [67] "medications.documented.at.the.time.of.chart.review..PMHx.section....choice.not.documented."                                                                                                                           
## [68] "prescribed.epinephrine.at.time.of.food.allergy.diagnosis"                                                                                                                                                             
## [69] "works.in.food.service.or.other.occupational.food.handling..chef..catering..fast.food..butcher..fishmonger..etc.."                                                                                                     
## [70] "works.in.an.occupation.with.chemicals.or.other.sensitizers..carpenter..painter..woodworker..lab.tech.or.researcher..firefighter..military..miner..etc.."                                                              
## [71] "Has.this.patient.ever.been.on.OIT..oral.immunotherapy..for.a.food.allergy"                                                                                                                                            
## [72] "peanut.total.IgE"                                                                                                                                                                                                     
## [73] "peanut.component.1.IgE"                                                                                                                                                                                               
## [74] "peanut.component.2.IgE"                                                                                                                                                                                               
## [75] "peanut.component.3.IgE"                                                                                                                                                                                               
## [76] "peanut.component.6.IgE"                                                                                                                                                                                               
## [77] "peanut.component.8.IgE"                                                                                                                                                                                               
## [78] "peanut.component.9.IgE"                                                                                                                                                                                               
## [79] "peanut.skin.test.wheal.size.average"                                                                                                                                                                                  
## [80] "Peanut.skin.test.interpretation"                                                                                                                                                                                      
## [81] "peanut.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema.."                                                                                                                                          
## [82] "peanut.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea.."                                                                                                                                  
## [83] "peanut.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath.."                                                                                               
## [84] "peanut.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness.."                                                                                                             
## [85] "peanut.symptoms.with.any.prior.reaction..choice.Neurologic..headache..parasthesias.."                                                                                                                                 
## [86] "peanut.symptoms.with.any.prior.reaction..choice.Other."                                                                                                                                                               
## [87] "peanut.symptoms.with.any.prior.reaction..choice.not.documented."                                                                                                                                                      
## [88] "peanut.other.symptom.description"                                                                                                                                                                                     
## [89] "peanut.severity.of.any.prior.reaction..choice.no.treatment.or.antihistamine.only."                                                                                                                                    
## [90] "peanut.severity.of.any.prior.reaction..choice.presented.to.ED.and..or.epinephrine.use."                                                                                                                               
## [91] "peanut.severity.of.any.prior.reaction..choice.not.documented."                                                                                                                                                        
## [92] "peanut.age.of.allergy.onset"                                                                                                                                                                                          
## [93] "peanut.clinical.course"                                                                                                                                                                                               
## [94] "peanut.age.of.allergy.onset.multiple.choice..if.specific.age.is.not.known."                                                                                                                                           
## [95] "age_group"

Age and Age Group

wilcox.test(age.in.years ~ age_group, data = filtered_data, 
        exact = FALSE, alternative = "two.sided")
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  age.in.years by age_group
## W = 2020, p-value = 1.169e-07
## alternative hypothesis: true location shift is not equal to 0
filtered_data %>%
  group_by(age_group) %>%
  get_summary_stats(age.in.years, type = "common") 
ggboxplot(filtered_data, x = "age_group", y = "age.in.years", 
          color ="age_group", palette = c("#00AFBB", "#E7B800"),
          ylab = "age (years)", xlab = "Age Group") + theme(legend.position = "none") + ggtitle("") +   theme(title  = element_text(face="bold", size = 15))

Difference in Sex by Age

#filtered_data$Sex <- dplyr::recode(filtered_data$Sex, female = "0", male = "1", na.action = "na.omit")


filtered_data$Sex <- as.factor(filtered_data$Sex)

table(filtered_data$Sex)
## 
## female   male 
##     81     59
cont_tablesex <- table(filtered_data$age_group, filtered_data$Sex)
fisher_resultsex <- fisher.test(cont_tablesex)




rownames(cont_tablesex) <- c( "Adult","Child")
colnames(cont_tablesex) <- c( "Female","Male")

fisher_resultsex
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_tablesex
## p-value = 0.4542
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.551465 5.772575
## sample estimates:
## odds ratio 
##   1.682641
kbl(cont_tablesex) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Female Male
Adult 13 6
Child 68 53

Difference in Symptoms

Hives/angioedema

class(filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema..)
## [1] "character"
filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema.. <- as.factor(filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema..)


table(filtered_data$age_group)
## 
## adult child 
##    19   121
cont_table <- table(filtered_data$age_group, filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema..)

fisher_result <- fisher.test(cont_table)

chisquaretab_hives <- table(filtered_data$age_group, filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema..)
#chisq.test(chisquaretab_hives)


rownames(cont_table) <- c( "Adult","Child")
colnames(cont_table) <- c( "No","Yes")


kbl(cont_table) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
No Yes
Adult 14 5
Child 100 21
fisher_result
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table
## p-value = 0.3501
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.1753602 2.3249070
## sample estimates:
## odds ratio 
##  0.5905157
df1 = filtered_data %>% 
  count(age_group, peanut.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema..) %>% 
  group_by(age_group) %>% 
  mutate(prop=prop.table(n))

df1
ggplot(df1, aes(age_group, fill = peanut.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema..))+
geom_bar(aes(y = prop*100),
    position = "dodge", stat = "identity") + scale_fill_discrete(name = "SkinSymptom", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("age_group") + ggtitle("Age of Onset  and Angiodema") + theme(title  = element_text(face="bold", size = 15))

GI, Emesis/Diarrhea

filtered_data$peanut.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea.. <- as.factor(filtered_data$peanut.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea..)


cont_table <- table(filtered_data$age_group, filtered_data$peanut.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea..)
fisher_result <- fisher.test(cont_table)

chisquaretab_GI <- table(filtered_data$age_group, filtered_data$peanut.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea..)
#chisq.test(chisquaretab_GI)



rownames(cont_table) <- c( "Adult","Child")
colnames(cont_table) <- c( "No","Yes")


kbl(cont_table) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
No Yes
Adult 6 13
Child 44 77
fisher_result
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table
## p-value = 0.7999
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.2348235 2.4817296
## sample estimates:
## odds ratio 
##  0.8088988
df1 = filtered_data %>% 
  count(age_group, peanut.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea..) %>% 
  group_by(age_group) %>% 
  mutate(prop=prop.table(n))

ggplot(df1, aes(age_group, fill = peanut.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea..))+
geom_bar(aes(y = prop*100),
    position = "dodge", stat = "identity") + scale_fill_discrete(name = "GI", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("age_group") + ggtitle("GI symptoms and Age of Onset") + theme(title  = element_text(face="bold", size = 15))

Respiratory

filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath.. <- as.factor(filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath..)

filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath.. <- as.factor(filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath..)


cont_table <- table(filtered_data$age_group, filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath..)
fisher_result <- fisher.test(cont_table)


chisquaretab_respitory <- table(filtered_data$age_group, filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath..)
#chisq.test(chisquaretab_respitory)



rownames(cont_table) <- c( "Adult","Child")
colnames(cont_table) <- c( "No","Yes")

kbl(cont_table) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
No Yes
Adult 10 9
Child 49 72
fisher_result
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table
## p-value = 0.3305
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.5491082 4.8925793
## sample estimates:
## odds ratio 
##   1.626769
df1 = filtered_data %>% 
  count(age_group, peanut.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath..) %>% 
  group_by(age_group) %>% 
  mutate(prop=prop.table(n))

df1
ggplot(df1, aes(age_group, fill = peanut.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath..))+
geom_bar(aes(y = prop*100),
    position = "dodge", stat = "identity") + scale_fill_discrete(name = "Respiratory", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("age_group") + ggtitle("Respiratory and Age of Onset") + theme(title  = element_text(face="bold", size = 15))

Cardiac

filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness.. <- as.factor(filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness..)

filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness.. <- as.factor(filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness..)


cont_table <- table(filtered_data$age_group, filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness..)
fisher_result <- fisher.test(cont_table)

chisquarecardiac <- table(filtered_data$age_group, filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness..)
#chisq.test(chisquarecardiac)

fisher_result
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.000000 9.956218
## sample estimates:
## odds ratio 
##          0
rownames(cont_table) <- c( "Adult","Child")
colnames(cont_table) <- c( "No","Yes")


kbl(cont_table) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
No Yes
Adult 0 19
Child 4 117
fisher_result
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.000000 9.956218
## sample estimates:
## odds ratio 
##          0
df1 = filtered_data %>% 
  count(age_group, peanut.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness..) %>% 
  group_by(age_group) %>% 
  mutate(prop=prop.table(n))

ggplot(df1, aes(age_group, fill = peanut.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness..))+
geom_bar(aes(y = prop*100),
    position = "dodge", stat = "identity") + scale_fill_discrete(name = "Cardiac Symptoms", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("age_group") + ggtitle("Cardiac") + theme(title  = element_text(face="bold", size = 15))

Neurological

filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Neurologic..headache..parasthesias.. <- as.factor(filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Neurologic..headache..parasthesias..)

filtered_data$neurosymp <- as.factor(filtered_data$peanut.symptoms.with.any.prior.reaction..choice.Neurologic..headache..parasthesias..)


cont_table <- table(filtered_data$age_group, filtered_data$neurosymp)
fisher_result <- fisher.test(cont_table)

chisquareneuro <- table(filtered_data$age_group, filtered_data$neurosymp)
#chisq.test(chisquareneuro)

rownames(cont_table) <- c( "Adult","Child")
colnames(cont_table) <- c( "No","Yes")

kbl(cont_table) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
No Yes
Adult 1 18
Child 4 117
fisher_result
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table
## p-value = 0.5232
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.03127908 17.61353048
## sample estimates:
## odds ratio 
##   1.618394
df1 = filtered_data %>% 
  count(age_group, neurosymp) %>% 
  group_by(age_group) %>% 
  mutate(prop=prop.table(n))

ggplot(df1, aes(age_group, fill = neurosymp))+
geom_bar(aes(y = prop*100),
    position = "dodge", stat = "identity") + scale_fill_discrete(name = "Neuro Symptoms", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("age_group") + ggtitle("Neuro Symptoms") + theme(title  = element_text(face="bold", size = 15))

IgE and Wheel Size

IgE - total and components

wilcox.test(peanut.total.IgE ~ age_group, data = filtered_data, 
        exact = FALSE, alternative = "two.sided")
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  peanut.total.IgE by age_group
## W = 248, p-value = 0.01169
## alternative hypothesis: true location shift is not equal to 0
wilcox.test(peanut.component.1.IgE ~ age_group, data = filtered_data, 
        exact = FALSE, alternative = "two.sided")
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  peanut.component.1.IgE by age_group
## W = 3, p-value = 0.2419
## alternative hypothesis: true location shift is not equal to 0
wilcox.test(peanut.component.2.IgE ~ age_group, data = filtered_data, 
        exact = FALSE, alternative = "two.sided")
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  peanut.component.2.IgE by age_group
## W = 26, p-value = 0.01477
## alternative hypothesis: true location shift is not equal to 0
wilcox.test(peanut.component.6.IgE ~ age_group, data = filtered_data, 
        exact = FALSE, alternative = "two.sided")
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  peanut.component.6.IgE by age_group
## W = 1, p-value = 0.1835
## alternative hypothesis: true location shift is not equal to 0
wilcox.test(peanut.component.8.IgE~ age_group, data = filtered_data, 
        exact = FALSE, alternative = "two.sided")
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  peanut.component.8.IgE by age_group
## W = 7, p-value = 0.438
## alternative hypothesis: true location shift is not equal to 0
wilcox.test(peanut.component.9.IgE ~ age_group, data = filtered_data, 
        exact = FALSE, alternative = "two.sided")
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  peanut.component.9.IgE by age_group
## W = 17.5, p-value = 0.2415
## alternative hypothesis: true location shift is not equal to 0
filtered_data %>%
  group_by(age_group) %>%
  get_summary_stats(peanut.total.IgE, type = "common") 
ggboxplot(filtered_data, x = "age_group", y = "peanut.total.IgE", 
          color ="age_group", palette = c("#00AFBB", "#E7B800"),
          ylab = "Total IGE", xlab = "age") + theme(legend.position = "none") + ggtitle("Age and Total IgE") + theme(title  = element_text(face="bold", size = 15))
## Warning: Removed 44 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

Wheal Size

wilcox.test(peanut.skin.test.wheal.size.average ~ age_group, data = filtered_data, 
        exact = FALSE, alternative = "two.sided")
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  peanut.skin.test.wheal.size.average by age_group
## W = 174.5, p-value = 0.0241
## alternative hypothesis: true location shift is not equal to 0
filtered_data %>%
  group_by(age_group) %>%
  get_summary_stats(peanut.skin.test.wheal.size.average, type = "common") 
ggboxplot(filtered_data, x = "age_group", y = "peanut.skin.test.wheal.size.average", 
          color ="age_group", palette = c("#00AFBB", "#E7B800"),
          ylab = "peanut.skin.test.wheal.size.average", xlab = "age") + theme(legend.position = "none") + ggtitle("Age and Wheal Size") + theme(title  = element_text(face="bold", size = 15))
## Warning: Removed 73 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

Severity, Requiring ED and/or EPI

filtered_data$peanut.severity.of.any.prior.reaction..choice.presented.to.ED.and..or.epinephrine.use.
##   [1] "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Unchecked"
##   [7] "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Checked"  
##  [13] "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Checked"  
##  [19] "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Unchecked"
##  [25] "Unchecked" "Checked"   "Checked"   "Checked"   "Unchecked" "Unchecked"
##  [31] "Unchecked" "Unchecked" "Unchecked" "Checked"   "Unchecked" "Unchecked"
##  [37] "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Checked"   "Unchecked"
##  [43] "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Checked"   "Unchecked"
##  [49] "Unchecked" "Checked"   "Checked"   "Checked"   "Unchecked" "Unchecked"
##  [55] "Checked"   "Checked"   "Checked"   "Checked"   "Unchecked" "Checked"  
##  [61] "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Checked"   "Checked"  
##  [67] "Checked"   "Checked"   "Unchecked" "Unchecked" "Unchecked" "Unchecked"
##  [73] "Unchecked" "Unchecked" "Unchecked" "Checked"   "Unchecked" "Unchecked"
##  [79] "Unchecked" "Unchecked" "Checked"   "Checked"   "Unchecked" "Unchecked"
##  [85] "Checked"   "Unchecked" "Checked"   "Unchecked" "Unchecked" "Unchecked"
##  [91] "Checked"   "Checked"   "Unchecked" "Checked"   "Unchecked" "Unchecked"
##  [97] "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Unchecked"
## [103] "Checked"   "Checked"   "Checked"   "Unchecked" "Checked"   "Unchecked"
## [109] "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Unchecked" "Unchecked"
## [115] "Unchecked" "Checked"   "Unchecked" "Unchecked" "Checked"   "Checked"  
## [121] "Unchecked" "Unchecked" "Checked"   "Unchecked" "Checked"   "Checked"  
## [127] "Checked"   "Checked"   "Unchecked" "Checked"   "Unchecked" "Checked"  
## [133] "Checked"   "Checked"   "Unchecked" "Unchecked" "Checked"   "Checked"  
## [139] "Unchecked" "Unchecked"
filtered_data$epied <- as.factor(filtered_data$peanut.severity.of.any.prior.reaction..choice.presented.to.ED.and..or.epinephrine.use.)

table(filtered_data$epied)
## 
##   Checked Unchecked 
##        46        94
EDepinephrine <- table(filtered_data$age_group, filtered_data$peanut.severity.of.any.prior.reaction..choice.presented.to.ED.and..or.epinephrine.use.)
fisher.test(EDepinephrine)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  EDepinephrine
## p-value = 0.3002
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.1144177 1.7180464
## sample estimates:
## odds ratio 
##  0.5038326
EDepinephrine
##        
##         Checked Unchecked
##   adult       4        15
##   child      42        79
df1 = filtered_data %>% 
  count(age_group, epied) %>% 
  group_by(age_group) %>% 
  mutate(prop=prop.table(n))

df1
ggplot(df1, aes(age_group, fill = epied))+
geom_bar(aes(y = prop*100),
    position = "dodge", stat = "identity") + scale_fill_discrete(name = "Epi-ED", labels = c("Yes", "No"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Age") + ggtitle("") + theme(title  = element_text(face="bold", size = 15))

requiring antihistamine only

notxantihisonly <- table(filtered_data$age_group, filtered_data$peanut.severity.of.any.prior.reaction..choice.no.treatment.or.antihistamine.only.)
fisher.test(notxantihisonly)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  notxantihisonly
## p-value = 0.4032
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.09177257 2.00816413
## sample estimates:
## odds ratio 
##  0.5236189
notxantihisonly
##        
##         Checked Unchecked
##   adult       3        16
##   child      32        89

Prescribed EPI at Time of DX - No differences by Age

EPIDX <- table(filtered_data$age_group, filtered_data$prescribed.epinephrine.at.time.of.food.allergy.diagnosis)
fisher.test(EPIDX)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  EPIDX
## p-value = 0.3566
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.05310712 65.83638131
## sample estimates:
## odds ratio 
##   3.264799
EPIDX
##        
##          no yes
##   adult   1  18
##   child   2 119
df1 = filtered_data %>% 
  count(age_group, prescribed.epinephrine.at.time.of.food.allergy.diagnosis) %>% 
  group_by(age_group) %>% 
  mutate(prop=prop.table(n))

df1
ggplot(df1, aes(age_group, fill = prescribed.epinephrine.at.time.of.food.allergy.diagnosis))+
geom_bar(aes(y = prop*100),
    position = "dodge", stat = "identity") + scale_fill_discrete(name = "prescribed epi", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Age") + ggtitle("") + theme(title  = element_text(face="bold", size = 15))

Medical Comorbidities

Allergic Rhinitis Comorbidity

View(filtered_data)
cont_table_medcomorbidAR <- table(filtered_data$age_group, filtered_data$medical.comorbidities.documented.at.the.time.of.chart.review...choice.allergic.rhinitis.)
cont_table_medcomorbidAR
##        
##         Checked Unchecked
##   adult       9        10
##   child      81        40
fisher.test(cont_table_medcomorbidAR)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table_medcomorbidAR
## p-value = 0.1235
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.1476445 1.3332620
## sample estimates:
## odds ratio 
##  0.4472098
rownames(cont_table_medcomorbidAR) <- c( "Adult","Child")
colnames(cont_table_medcomorbidAR) <- c( "Yes","No")


kbl(cont_table_medcomorbidAR) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 9 10
Child 81 40

Asthma Comorbidity

cont_table_medcomorbid <- table(filtered_data$age_group, filtered_data$medical.comorbidities.documented.at.the.time.of.chart.review...choice.asthma.)


fisher.test(cont_table_medcomorbid)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table_medcomorbid
## p-value = 0.3305
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.5491082 4.8925793
## sample estimates:
## odds ratio 
##   1.626769
rownames(cont_table_medcomorbid) <- c( "Adult","Child")
colnames(cont_table_medcomorbid) <-  c( "Yes","No")


kbl(cont_table_medcomorbid) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 10 9
Child 49 72

Eczema Comorbidity

cont_table_medcomorbidEC<- table(filtered_data$age_group, filtered_data$medical.comorbidities.documented.at.the.time.of.chart.review...choice.eczema.)
fisher.test(cont_table_medcomorbidEC)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table_medcomorbidEC
## p-value = 0.09907
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.02984487 1.27845012
## sample estimates:
## odds ratio 
##  0.2797535
rownames(cont_table_medcomorbidEC) <- c( "Adult","Child")
colnames(cont_table_medcomorbidEC) <-  c( "Yes","No")


kbl(cont_table_medcomorbidEC) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 2 17
Child 36 85

Oral Allergy Syndrome Comorbidity

cont_table_medcomorbidOAS<- table(filtered_data$age_group, filtered_data$medical.comorbidities.documented.at.the.time.of.chart.review...choice.oral.allergy.syndrome.)
fisher.test(cont_table_medcomorbidOAS)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table_medcomorbidOAS
## p-value = 0.1361
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.3561358 42.8095145
## sample estimates:
## odds ratio 
##   4.549209
rownames(cont_table_medcomorbidOAS) <-  c( "Adult","Child")
colnames(cont_table_medcomorbidOAS) <-  c( "Yes","No")


kbl(cont_table_medcomorbidOAS) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 2 17
Child 3 118

Food Allergy

Kids have more Treenut Allergy

treenut <- table(filtered_data$age_group, filtered_data$Food.allergy..choice.tree.nut.)

fisher.test(treenut)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  treenut
## p-value = 0.002109
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.03904981 0.58137995
## sample estimates:
## odds ratio 
##  0.1715081
rownames(treenut) <- c( "Adult","Child")
colnames(treenut) <- c( "Yes","No")

kbl(treenut) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 4 15
Child 74 47
filtered_data$treenut <- as.factor(filtered_data$Food.allergy..choice.tree.nut.)

df1 = filtered_data %>% 
  count(age_group, treenut) %>% 
  group_by(age_group) %>% 
  mutate(prop=prop.table(n))

df1
ggplot(df1, aes(age_group, fill = treenut))+
geom_bar(aes(y = prop*100),
    position = "dodge", stat = "identity") + scale_fill_discrete(name = "treenut allergy", labels = c("Yes", "No"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Age Group") + ggtitle("Treenut Allergy Greater in Children with Peanut Allergies") + theme(title  = element_text(face="bold", size = 15))

fish <- table(filtered_data$age_group, filtered_data$Food.allergy..choice.fish.)

fisher.test(fish)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  fish
## p-value = 0.2418
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.2395427 18.2001844
## sample estimates:
## odds ratio 
##    2.70298
rownames(fish) <- c( "Adult","Child")
colnames(fish) <- c( "Yes","No")

kbl(fish) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 2 17
Child 5 116
milk <- table(filtered_data$age_group, filtered_data$Food.allergy..choice.milk.)
fisher.test(milk)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  milk
## p-value = 0.4458
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.03945649 28.76181256
## sample estimates:
## odds ratio 
##   2.169512
rownames(milk) <- c( "Adult","Child")
colnames(milk) <- c( "Yes","No")

kbl(milk) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 1 18
Child 3 118
egg <- table(filtered_data$age_group, filtered_data$Food.allergy..choice.egg.)

fisher.test(egg)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  egg
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.0986922 4.9463443
## sample estimates:
## odds ratio 
##  0.9775303
rownames(egg) <- c( "Adult","Child")
colnames(egg) <- c( "Yes","No")

kbl(egg) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 2 17
Child 13 108
soy <- table(filtered_data$age_group, filtered_data$Food.allergy..choice.soy.)

fisher.test(soy)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  soy
## p-value = 0.5903
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.02583288 12.50007372
## sample estimates:
## odds ratio 
##    1.28635
rownames(soy) <- c( "Adult","Child")
colnames(soy) <- c( "Yes","No")

kbl(soy) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 1 18
Child 5 116
sesame <- table(filtered_data$age_group, filtered_data$Food.allergy..choice.sesame.)
rownames(sesame) <- c( "Adult","Child")
colnames(sesame) <- c( "Yes","No")
kbl(sesame) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 0 19
Child 7 114
wheat <- table(filtered_data$age_group, filtered_data$Food.allergy..choice.wheat.)
fisher.test(wheat)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  wheat
## p-value = 0.3566
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.05310712 65.83638131
## sample estimates:
## odds ratio 
##   3.264799
rownames(wheat) <- c( "Adult","Child")
colnames(wheat) <- c( "Yes","No")


kbl(wheat) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 1 18
Child 2 119

Other Food Allergy

cont_table_otherfoodallergy<- table(filtered_data$age_group, filtered_data$medical.comorbidities.documented.at.the.time.of.chart.review...choice.other.food.allergy.)
fisher.test(cont_table_otherfoodallergy)
## 
##  Fisher's Exact Test for Count Data
## 
## data:  cont_table_otherfoodallergy
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.07937445 3.79248239
## sample estimates:
## odds ratio 
##   0.773392
rownames(cont_table_otherfoodallergy) <- c( "Adult","Child")
colnames(cont_table_otherfoodallergy) <- c( "Yes","No")

kbl(cont_table_otherfoodallergy) %>%
  kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)
Yes No
Adult 2 17
Child 16 105