getwd()## [1] "/Users/Noura/Desktop/archive/Omar_AI"
list.files()## [1] "AdultFoodAllergyCorr-PeanutAllergy_DATA_2026-04-15_1404.csv"
## [2] "AdultFoodAllergyCorr-PeanutAllergy_DATA_LABELS_2026-04-15_1403.csv"
## [3] "AdultFoodAllergyCorr-PeanutAllergy_R_2026-04-15_1404.r"
## [4] "AdultFoodAllergyCorr-ShellfishTrueAllergy_DATA_LABELS_2024-04-30_0948.csv"
## [5] "AdultFoodAllergyCorr-ShellfishTrueAllergy_DATA_LABELS_2024-05-30_0822.csv"
## [6] "AdultFoodAllergyCorr-ShellfishTrueAllergy_DATA_LABELS_2024-06-02_1910.csv"
## [7] "AdultFoodAllergyCorr-ShellfishTrueAllergy_DATA_LABELS_2024-06-10_0733.csv"
## [8] "Black Chalkboard First Day of School Board.png"
## [9] "filtereddata.csv"
## [10] "Food Allergy Action Plan.PDF"
## [11] "JU_Robinson_Report_NME (1).docx"
## [12] "JU_Robinson_Report_NME.docx"
## [13] "NEWAIDATA.csv"
## [14] "NEWOMAR_6224.html"
## [15] "NEWOMAR_6224.Rmd"
## [16] "NEWOMAR_files"
## [17] "NEWOMAR.html"
## [18] "NEWOMAR.Rmd"
## [19] "NJ_ScoreSummary_5.23.24.xlsx"
## [20] "OMarAI"
## [21] "omarai.csv"
## [22] "OMarAI.Rproj"
## [23] "omarai2.csv"
## [24] "Omarallergy.csv"
## [25] "PeanutProject.html"
## [26] "PeanutProject.Rmd"
## [27] "Redic_ClientReport_NJ_5.30.docx"
## [28] "Redic_ClientReport_NJ_NME.docx"
## [29] "rsconnect"
## [30] "tmp-pdfcrop-61138.tex"
datanew2026 <- read.csv('AdultFoodAllergyCorr-PeanutAllergy_DATA_LABELS_2026-04-15_1403.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"] <- 0col_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 37
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 37
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"
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)## Warning in chisq.test(chisquaretab_hives): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: chisquaretab_hives
## X-squared = 0.38, df = 1, p-value = 0.5376
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))
df1ggplot(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))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)##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: chisquaretab_GI
## X-squared = 0.021652, df = 1, p-value = 0.883
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))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)##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: chisquaretab_respitory
## X-squared = 0.5566, df = 1, p-value = 0.4556
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))
df1ggplot(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))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)## Warning in chisq.test(chisquarecardiac): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: chisquarecardiac
## X-squared = 0.0040299, df = 1, p-value = 0.9494
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))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)## Warning in chisq.test(chisquareneuro): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: chisquareneuro
## X-squared = 7.3044e-30, df = 1, p-value = 1
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))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()`).
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()`).