Omarallergy<- as.data.frame(read.csv("NEWAIDATA.csv"))
record_ids_to_exclude <- c(20, 39, 58, 134, 142, 188, 189, 234, 273, 304, 312, 329, 331, 344, 355, 368,444,511)
Omarallergy <- Omarallergy[!(Omarallergy$Record.ID %in% record_ids_to_exclude), ]
psych::describe(Omarallergy)Omarallergy$Race..ethnicity..choice.otherRace. <- Omarallergy$Race..ethnicity..choice.other.
Omarallergy$Race..ethnicity..choice.other. <- NULL
##changing the variable names for ease
names(Omarallergy)<- gsub("Race..ethnicity..choice.", "", names(Omarallergy))
names(Omarallergy)<- gsub("shellfish.that.the.patient.reacted.to..or.suspected.reacted.to...choice.", "", names(Omarallergy))
Omarallergy[][Omarallergy[] == "Checked"] <- 1
Omarallergy[][Omarallergy[] == "Unchecked"] <- 0col_names <- colnames(Omarallergy)
duplicate_cols <- col_names[duplicated(col_names)]
Omarallergy <- mutate(Omarallergy, pdemrace = ifelse(White. == 1, "1", ifelse(Black.or.African.American. == 1, "2", ifelse(American.Indian.or.Alaska.Native. == 1, "3", ifelse(Asian. == 1, "3", ifelse(Native.Hawaiian.or.Other.Pacific.Islander. == 1, "3", ifelse(not.documented. == 1, "3",
ifelse(otherRace. == 1, "3",
ifelse(not.documented..1 == 1, 3, "")))))))))
# table(Omarallergy$pdemrace)
filtered_data <- Omarallergy %>%
filter(pdemrace != 3)
z <- table(filtered_data$pdemrace)
rownames(z) <- c( "White","Black")
kbl(z) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| Var1 | Freq |
|---|---|
| White | 96 |
| Black | 114 |
filtered_data$race <- dplyr::recode(filtered_data$pdemrace, "1" = "White", "2" = "Black")
View(filtered_data)
filtered_data$pdemrace <- as.factor(filtered_data$pdemrace)
# anova(lm(age.in.years~ pdemrace, data=filtered_data))
wilcox.test(age.in.years ~ pdemrace, data = filtered_data,
exact = FALSE, alternative = "two.sided")##
## Wilcoxon rank sum test with continuity correction
##
## data: age.in.years by pdemrace
## W = 5806.5, p-value = 0.4463
## alternative hypothesis: true location shift is not equal to 0
filtered_data %>%
group_by(race) %>%
get_summary_stats(age.in.years, type = "common") ggboxplot(filtered_data, x = "race", y = "age.in.years",
color ="race", palette = c("#00AFBB", "#E7B800"),
ylab = "age (years)", xlab = "Race") + theme(legend.position = "none") + ggtitle("Figure 1. No Difference in Age in Years by Race") + theme(title = element_text(face="bold", size = 15))# anova(lm(shellfish.age.of.allergy.onset ~ pdemrace, data=filtered_data))
wilcox.test(shellfish.age.of.allergy.onset ~ pdemrace, data = filtered_data,
exact = FALSE, alternative = "two.sided")##
## Wilcoxon rank sum test with continuity correction
##
## data: shellfish.age.of.allergy.onset by pdemrace
## W = 1458.5, p-value = 0.6326
## alternative hypothesis: true location shift is not equal to 0
filtered_data %>%
group_by(race) %>%
get_summary_stats(shellfish.age.of.allergy.onset, type = "common") ggboxplot(filtered_data, x = "race", y = "shellfish.age.of.allergy.onset",
color ="race", palette = c("#00AFBB", "#E7B800"),
ylab = "age of onset of allergy (years)", xlab = "Race") + theme(legend.position = "none") + ggtitle("Figure 2. No Racial differences in SF Allergy Onset Age") + theme(title = element_text(face="bold", size = 15))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)
cont_tablesex <- table(filtered_data$pdemrace, filtered_data$Sex)
fisher_resultsex <- fisher.test(cont_tablesex)
rownames(cont_tablesex) <- c( "White","Black")
colnames(cont_tablesex) <- c( "Female","Male")
fisher_resultsex##
## Fisher's Exact Test for Count Data
##
## data: cont_tablesex
## p-value = 0.0005618
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.1783935 0.6538752
## sample estimates:
## odds ratio
## 0.3446718
kbl(cont_tablesex) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| Female | Male | |
|---|---|---|
| White | 54 | 42 |
| Black | 90 | 24 |
filtered_data$rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.cockroach. <- as.factor(filtered_data$rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.cockroach.)
df1 = filtered_data %>%
count(race, rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.cockroach.) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
cont_table <- table(filtered_data$pdemrace, filtered_data$rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.cockroach.)
fisher_result <- fisher.test(cont_table)
rownames(cont_table) <- c( "White","Black")
colnames(cont_table) <- c( "Not","Sensitized")
kbl(cont_table) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| Not | Sensitized | |
|---|---|---|
| White | 65 | 31 |
| Black | 74 | 40 |
fisher_result##
## Fisher's Exact Test for Count Data
##
## data: cont_table
## p-value = 0.7698
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.613361 2.102886
## sample estimates:
## odds ratio
## 1.132715
ggplot(df1, aes(race, fill = rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.cockroach.))+
geom_bar(aes(y = prop*100),
position = "dodge", stat = "identity") + scale_fill_discrete(name = "Roach Sensitization", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Race") + ggtitle("Figure 3. No Racial Differences in Roach Sensitization") + theme(title = element_text(face="bold", size = 15))filtered_data$rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.dust.mite. <- as.factor(filtered_data$rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.dust.mite.)
df1 = filtered_data %>%
count(race, rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.dust.mite.) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
cont_table <- table(filtered_data$pdemrace, filtered_data$rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.dust.mite.)
fisher_result <- fisher.test(cont_table)
rownames(cont_table) <- c( "White","Black")
colnames(cont_table) <- c( "Not","Sensitized")
kbl(cont_table) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| Not | Sensitized | |
|---|---|---|
| White | 46 | 50 |
| Black | 44 | 70 |
fisher_result ##
## Fisher's Exact Test for Count Data
##
## data: cont_table
## p-value = 0.208
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.813804 2.632418
## sample estimates:
## odds ratio
## 1.460926
ggplot(df1, aes(race, fill = rhinitis.specific.sensitization..skin.test.or.serum.IgE...choice.dust.mite.))+
geom_bar(aes(y = prop*100),
position = "dodge", stat = "identity") + scale_fill_discrete(name = "Dust Mite Sensitization", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Race") + ggtitle("Figure 4. No Racial Differences in \n Dust Mite Sensitization") + theme(title = element_text(face="bold", size = 15))filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema.. <- as.factor(filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema..)
cont_table <- table(filtered_data$pdemrace, filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema..)
fisher_result <- fisher.test(cont_table)
rownames(cont_table) <- c( "White","Black")
colnames(cont_table) <- c( "No","Yes")
kbl(cont_table) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 23 | 73 |
| Black | 15 | 99 |
fisher_result##
## Fisher's Exact Test for Count Data
##
## data: cont_table
## p-value = 0.04892
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.9595547 4.5926514
## sample estimates:
## odds ratio
## 2.072129
df1 = filtered_data %>%
count(race, shellfish.symptoms.with.any.prior.reaction..choice.Skin..hives.or.angioedema..) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = shellfish.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("Race") + ggtitle("Figure 5. Marginal Racial Difference in Hives/Angioedema") + theme(title = element_text(face="bold", size = 15))filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea.. <- as.factor(filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea..)
cont_table <- table(filtered_data$pdemrace, filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea..)
fisher_result <- fisher.test(cont_table)
rownames(cont_table) <- c( "White","Black")
colnames(cont_table) <- c( "No","Yes")
kbl(cont_table) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 70 | 26 |
| Black | 93 | 21 |
fisher_result##
## Fisher's Exact Test for Count Data
##
## data: cont_table
## p-value = 0.1392
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.2990554 1.2294264
## sample estimates:
## odds ratio
## 0.6094171
df1 = filtered_data %>%
count(race, shellfish.symptoms.with.any.prior.reaction..choice.GI..nausea..vomiting..or.diarrhea..) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = shellfish.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("Race") + ggtitle("Figure 6. No Racial Differences in GI Symptoms") + theme(title = element_text(face="bold", size = 15))filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath.. <- as.factor(filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath..)
filtered_data$respiratory <- as.factor(filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Respiratory..wheezing..stridor..voice.change..or.shortness.of.breath..)
cont_table <- table(filtered_data$pdemrace, filtered_data$respiratory)
fisher_result <- fisher.test(cont_table)
rownames(cont_table) <- c( "White","Black")
colnames(cont_table) <- c( "No","Yes")
kbl(cont_table) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 40 | 56 |
| Black | 53 | 61 |
fisher_result##
## Fisher's Exact Test for Count Data
##
## data: cont_table
## p-value = 0.4898
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.4578537 1.4737504
## sample estimates:
## odds ratio
## 0.8228744
df1 = filtered_data %>%
count(race, respiratory) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = respiratory))+
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("Race") + ggtitle("Figure 7. No Racial Differences in Respiratory Symptoms") + theme(title = element_text(face="bold", size = 15))filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness.. <- as.factor(filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness..)
filtered_data$cardiacsymp <- as.factor(filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Cardiovascular..hypotension..syncope..lightheartedness..)
cont_table <- table(filtered_data$pdemrace, filtered_data$cardiacsymp)
fisher_result <- fisher.test(cont_table)
rownames(cont_table) <- c( "White","Black")
colnames(cont_table) <- c( "No","Yes")
kbl(cont_table) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 91 | 5 |
| Black | 110 | 4 |
fisher_result##
## Fisher's Exact Test for Count Data
##
## data: cont_table
## p-value = 0.7349
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.1276666 3.1801351
## sample estimates:
## odds ratio
## 0.6631358
df1 = filtered_data %>%
count(race, cardiacsymp) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = cardiacsymp))+
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("Race") + ggtitle("Figure 8. No Racial Differences in Cardiac Symptoms") + theme(title = element_text(face="bold", size = 15))filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Neurologic..headache..parasthesias.. <- as.factor(filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Neurologic..headache..parasthesias..)
filtered_data$neurosymp <- as.factor(filtered_data$shellfish.symptoms.with.any.prior.reaction..choice.Neurologic..headache..parasthesias..)
cont_table <- table(filtered_data$pdemrace, filtered_data$neurosymp)
fisher_result <- fisher.test(cont_table)
rownames(cont_table) <- c( "White","Black")
colnames(cont_table) <- c( "No","Yes")
kbl(cont_table) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 91 | 5 |
| Black | 112 | 2 |
fisher_result##
## Fisher's Exact Test for Count Data
##
## data: cont_table
## p-value = 0.2503
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.03043896 2.05201183
## sample estimates:
## odds ratio
## 0.3266769
df1 = filtered_data %>%
count(race, neurosymp) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, 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("Race") + ggtitle("Figure 9. No Racial Differences in Neuro Symptoms") + theme(title = element_text(face="bold", size = 15))cont_table_medcomorbidAR <- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.allergic.rhinitis)
fisher.test(cont_table_medcomorbidAR)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_medcomorbidAR
## p-value = 0.6334
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.6103689 2.3413828
## sample estimates:
## odds ratio
## 1.195792
rownames(cont_table) <- c( "White","Black")
colnames(cont_table) <- c( "No","Yes")
kbl(cont_table) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 91 | 5 |
| Black | 112 | 2 |
cont_table_medcomorbid <- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.asthma)
fisher.test(cont_table_medcomorbid)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_medcomorbid
## p-value = 0.2556
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.7684675 2.5723880
## sample estimates:
## odds ratio
## 1.400706
rownames(cont_table_medcomorbid) <- c( "White","Black")
colnames(cont_table_medcomorbid) <- c( "No","Yes")
kbl(cont_table_medcomorbid) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 64 | 32 |
| Black | 67 | 47 |
cont_table_medcomorbidEC<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.eczema)
fisher.test(cont_table_medcomorbidEC)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_medcomorbidEC
## p-value = 0.5794
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.5573043 2.8476393
## sample estimates:
## odds ratio
## 1.244902
rownames(cont_table_medcomorbidEC) <- c( "White","Black")
colnames(cont_table_medcomorbidEC) <- c( "No","Yes")
kbl(cont_table_medcomorbidEC) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 82 | 14 |
| Black | 94 | 20 |
cont_table_medcomorbidCD<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.contact.dermatitis)
fisher.test(cont_table_medcomorbidCD)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_medcomorbidCD
## p-value = 0.4155
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.03653308 2.95085260
## sample estimates:
## odds ratio
## 0.4124236
rownames(cont_table_medcomorbidCD) <- c( "White","Black")
colnames(cont_table_medcomorbidCD) <- c( "No","Yes")
kbl(cont_table_medcomorbidCD) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 92 | 4 |
| Black | 112 | 2 |
cont_table_medcomorbidOAS<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.oral.allergy.syndrome)
fisher.test(cont_table_medcomorbidOAS)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_medcomorbidOAS
## p-value = 0.1849
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.5642122 30.8965892
## sample estimates:
## odds ratio
## 3.059937
rownames(cont_table_medcomorbidOAS) <- c( "White","Black")
colnames(cont_table_medcomorbidOAS) <- c( "No","Yes")
kbl(cont_table_medcomorbidOAS) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 94 | 2 |
| Black | 107 | 7 |
cont_table_medcomorbidANXS<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.anxiety)
fisher.test(cont_table_medcomorbidANXS)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_medcomorbidANXS
## p-value = 0.406
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.2751168 1.7067296
## sample estimates:
## odds ratio
## 0.6903187
rownames(cont_table_medcomorbidANXS) <- c( "White","Black")
colnames(cont_table_medcomorbidANXS) <- c( "No","Yes")
kbl(cont_table_medcomorbidANXS) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 82 | 14 |
| Black | 102 | 12 |
filtered_data$otherpsych <- as.factor(filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.other.psychological.diagnosis..depression..bipolar..schizophrenia..etc.)
cont_table_medcomorbidPSY<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.other.psychological.diagnosis..depression..bipolar..schizophrenia..etc.)
fisher.test(cont_table_medcomorbidPSY)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_medcomorbidPSY
## p-value = 0.003038
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.1109345 0.7002356
## sample estimates:
## odds ratio
## 0.2900308
rownames(cont_table_medcomorbidPSY) <- c( "White","Black")
colnames(cont_table_medcomorbidPSY) <- c( "No","Yes")
kbl(cont_table_medcomorbidPSY) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 74 | 22 |
| Black | 105 | 9 |
df1 = filtered_data %>%
count(race, otherpsych) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = otherpsych))+
geom_bar(aes(y = prop*100),
position = "dodge", stat = "identity") + scale_fill_discrete(name = "other psych", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Race") + ggtitle("Figure 10. White Individuals Have \n Greater Proportion of Comorbid Other Psych DX") + theme(title = element_text(face="bold", size = 15))cont_table_medcomorbidhypertension<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.cardiac..hypertension..coronary.artery.dz..etc.)
fisher.test(cont_table_medcomorbidhypertension)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_medcomorbidhypertension
## p-value = 0.08685
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.8944657 3.4935575
## sample estimates:
## odds ratio
## 1.749169
rownames(cont_table_medcomorbidhypertension) <- c( "White","Black")
colnames(cont_table_medcomorbidhypertension) <- c( "No","Yes")
kbl(cont_table_medcomorbidhypertension) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 76 | 20 |
| Black | 78 | 36 |
cont_table_GI<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.gastrointestinal)
fisher.test(cont_table_GI)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_GI
## p-value = 0.6595
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.64163 2.21424
## sample estimates:
## odds ratio
## 1.188207
rownames(cont_table_GI) <- c( "White","Black")
colnames(cont_table_GI) <- c( "No","Yes")
kbl(cont_table_GI) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 66 | 30 |
| Black | 74 | 40 |
cont_table_alphagal<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.alpha.gal.allergy)
fisher.test(cont_table_alphagal)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_alphagal
## p-value = 0.04219
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.000000 1.257693
## sample estimates:
## odds ratio
## 0
rownames(cont_table_alphagal) <- c( "White","Black")
colnames(cont_table_alphagal) <- c( "No","Yes")
kbl(cont_table_alphagal) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 92 | 4 |
| Black | 114 | 0 |
filtered_data$alphagal <- as.factor(filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.alpha.gal.allergy)
df1 = filtered_data %>%
count(race, alphagal) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = alphagal))+
geom_bar(aes(y = prop*100),
position = "dodge", stat = "identity") + scale_fill_discrete(name = "alpha gal", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Race") + ggtitle("Figure 10. White Individuals Have \n Greater Proportion of Comorbid Alpha Gal") + theme(title = element_text(face="bold", size = 15))cont_table_otherfoodallergy<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.other.food.allergy)
fisher.test(cont_table_otherfoodallergy)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_otherfoodallergy
## p-value = 0.4461
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.6882361 2.5162859
## sample estimates:
## odds ratio
## 1.309079
rownames(cont_table_otherfoodallergy) <- c( "White","Black")
colnames(cont_table_otherfoodallergy) <- c( "No","Yes")
kbl(cont_table_otherfoodallergy) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 71 | 25 |
| Black | 78 | 36 |
filtered_data$drugallergy <- as.factor(filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.drug.allergy)
cont_table_otherdrugallergy<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.drug.allergy)
fisher.test(cont_table_otherdrugallergy)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_otherdrugallergy
## p-value = 0.09723
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.3482513 1.1232258
## sample estimates:
## odds ratio
## 0.6269876
rownames(cont_table_otherdrugallergy) <- c( "White","Black")
colnames(cont_table_otherdrugallergy) <- c( "No","Yes")
kbl(cont_table_otherdrugallergy) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 47 | 49 |
| Black | 69 | 45 |
df1 = filtered_data %>%
count(race, drugallergy) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = drugallergy))+
geom_bar(aes(y = prop*100),
position = "dodge", stat = "identity") + scale_fill_discrete(name = "drug allergy", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Race") + ggtitle("Figure 11. White Individuals Have \n Greater Proportion of Comorbid Drug Allergy") + theme(title = element_text(face="bold", size = 15))filtered_data$insectallergy <- as.factor(filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.stinging.insect.allergy..hymenoptera.)
cont_table_insectallergy<- table(filtered_data$pdemrace, filtered_data$medical.comorbidities.at.the.time.of.food.allergy.diagnosis..choice.stinging.insect.allergy..hymenoptera.)
fisher.test(cont_table_insectallergy)##
## Fisher's Exact Test for Count Data
##
## data: cont_table_insectallergy
## p-value = 0.1165
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.04963743 1.29201374
## sample estimates:
## odds ratio
## 0.2989531
rownames(cont_table_insectallergy) <- c( "White","Black")
colnames(cont_table_insectallergy) <- c( "No","Yes")
kbl(cont_table_insectallergy) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 88 | 8 |
| Black | 111 | 3 |
df1 = filtered_data %>%
count(race, insectallergy) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = insectallergy))+
geom_bar(aes(y = prop*100),
position = "dodge", stat = "identity") + scale_fill_discrete(name = "insect allergy", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Race") + ggtitle("Figure 12. White Individuals Have \n Greater Proportion of Comorbid Insect Allergy") + theme(title = element_text(face="bold", size = 15))PPI <- table(filtered_data$pdemrace, filtered_data$medications.prescribed.at.time.of.food.allergy.diagnosis..choice.proton.pump.inhibitor.)
fisher.test(PPI)##
## Fisher's Exact Test for Count Data
##
## data: PPI
## p-value = 0.5865
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.371189 1.781090
## sample estimates:
## odds ratio
## 0.8133125
BB <- table(filtered_data$pdemrace, filtered_data$medications.prescribed.at.time.of.food.allergy.diagnosis..choice.beta.blocker.)
fisher.test(BB)##
## Fisher's Exact Test for Count Data
##
## data: BB
## p-value = 0.2567
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.6360769 5.4420692
## sample estimates:
## odds ratio
## 1.775266
AceArb <- table(filtered_data$pdemrace, filtered_data$medications.prescribed.at.time.of.food.allergy.diagnosis..choice.ACE.ARB.)
fisher.test(AceArb)##
## Fisher's Exact Test for Count Data
##
## data: AceArb
## p-value = 0.3931
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.6181428 4.2617530
## sample estimates:
## odds ratio
## 1.574869
NSAID <- table(filtered_data$pdemrace, filtered_data$medications.documented.at.the.time.of.chart.review..PMHx.section...not.already.included.in.previous.medication.question...choice.NSAID..prescribed.or.documented.in.note..)
fisher.test(NSAID)##
## Fisher's Exact Test for Count Data
##
## data: NSAID
## p-value = 0.2915
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.7102191 3.3203993
## sample estimates:
## odds ratio
## 1.513872
Sulfasalazine <- table(filtered_data$pdemrace, filtered_data$medications.documented.at.the.time.of.chart.review..PMHx.section...not.already.included.in.previous.medication.question...choice.sulfasalazine..azulfidine..or.mesalamine..5.ASA..)ImmuneMod <- table(filtered_data$pdemrace, filtered_data$medications.documented.at.the.time.of.chart.review..PMHx.section...not.already.included.in.previous.medication.question...choice.immune.modulator..immune.suppressant..biologic..cyclophsophamide..MMF..calcineurin.inhibitor..mTOR.inhibitor..methotrexate..azathioprene..)
fisher.test(ImmuneMod)##
## Fisher's Exact Test for Count Data
##
## data: ImmuneMod
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.3301762 4.1135168
## sample estimates:
## odds ratio
## 1.131406
oralsteroid <- table(filtered_data$pdemrace, filtered_data$medications.prescribed.at.time.of.food.allergy.diagnosis..choice.daily.oral.steroid.)
fisher.test(oralsteroid)##
## Fisher's Exact Test for Count Data
##
## data: oralsteroid
## p-value = 0.2943
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.4511193 26.9498950
## sample estimates:
## odds ratio
## 2.600139
notxantihisonly <- table(filtered_data$pdemrace, filtered_data$shellfish.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.3096
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.3996987 1.3650616
## sample estimates:
## odds ratio
## 0.7394829
notxantihisonly##
## 0 1
## 1 60 36
## 2 79 35
notdocument <- table(filtered_data$pdemrace, filtered_data$shellfish.severity.of.any.prior.reaction..choice.not.documented)
fisher.test(notdocument)##
## Fisher's Exact Test for Count Data
##
## data: notdocument
## p-value = 0.2692
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.4080485 1.3108219
## sample estimates:
## odds ratio
## 0.7324531
notdocument ##
## 0 1
## 1 49 47
## 2 67 47
filtered_data$epied <- as.factor(filtered_data$shellfish.severity.of.any.prior.reaction..choice.presented.to.ED.and..or.epinephrine.use)
EDepinephrine <- table(filtered_data$pdemrace, filtered_data$shellfish.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.01306
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 1.180884 6.217303
## sample estimates:
## odds ratio
## 2.62465
EDepinephrine##
## 0 1
## 1 85 11
## 2 85 29
df1 = filtered_data %>%
count(race, epied) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
df1ggplot(df1, aes(race, fill = epied))+
geom_bar(aes(y = prop*100),
position = "dodge", stat = "identity") + scale_fill_discrete(name = "Epi-ED", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Race") + ggtitle("Figure 13. Greater Proportion of Black Individuals W/ \n Reaction Requiring Presenting to ED/Epi Use") + theme(title = element_text(face="bold", size = 15))EPIDX <- table(filtered_data$pdemrace, 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.1914
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.6384991 17.8471320
## sample estimates:
## odds ratio
## 2.895754
EPIDX##
## no yes
## 1 7 89
## 2 3 111
#
# clam <- table(filtered_data$pdemrace, filtered_data$clam.)
# fisher.test(clam)
#
# crab <- table(filtered_data$pdemrace, filtered_data$crab.)
# fisher.test(crab)
#
#
# lobster <- table(filtered_data$pdemrace, filtered_data$lobster.)
# fisher.test(lobster)
#
# scallops <- table(filtered_data$pdemrace, filtered_data$scallops.)
# fisher.test(scallops)
#
#
# shrimp <- table(filtered_data$pdemrace, filtered_data$shrimp.)
# fisher.test(shrimp)
filtered_data$clam. <- as.numeric(filtered_data$clam.)
filtered_data$oyster. <- as.numeric(filtered_data$oyster.)
filtered_data$scallops. <- as.numeric(filtered_data$scallops.)
filtered_data$crab. <- as.numeric(filtered_data$crab.)
filtered_data$shrimp. <- as.numeric(filtered_data$shrimp.)
filtered_data$lobster. <- as.numeric(filtered_data$lobster.)
filtered_data$mollusks <- ifelse(filtered_data$clam. | filtered_data$oyster. | filtered_data$scallops., 1, 0)
filtered_data$crustaceans <- ifelse(filtered_data$crab. | filtered_data$shrimp. | filtered_data$lobster., 1, 0)crustaceans <- table(filtered_data$pdemrace, filtered_data$crustaceans)
fisher.test(crustaceans)##
## Fisher's Exact Test for Count Data
##
## data: crustaceans
## p-value = 0.2347
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.7873682 2.7459666
## sample estimates:
## odds ratio
## 1.46753
mollusks <- table(filtered_data$pdemrace, filtered_data$mollusks)
fisher.test(mollusks)##
## Fisher's Exact Test for Count Data
##
## data: mollusks
## p-value = 0.01145
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.08565154 0.79344774
## sample estimates:
## odds ratio
## 0.2794467
rownames(mollusks) <- c( "White","Black")
colnames(mollusks) <- c( "No","Yes")
kbl(mollusks) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 80 | 16 |
| Black | 108 | 6 |
filtered_data$molluskss <- as.factor(filtered_data$mollusks)
df1 = filtered_data %>%
count(race, molluskss) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = molluskss))+
geom_bar(aes(y = prop*100),
position = "dodge", stat = "identity") + scale_fill_discrete(name = "mollusks allergy", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Race") + ggtitle("Figure 14. White Individuals Have Greater Proportion of Mollusks Allergy") + theme(title = element_text(face="bold", size = 15))+ difference is driven by oyster
oyster <- table(filtered_data$pdemrace, filtered_data$oyster.)
fisher.test(oyster)##
## Fisher's Exact Test for Count Data
##
## data: oyster
## p-value = 0.01884
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.0000000 0.8987685
## sample estimates:
## odds ratio
## 0
rownames(oyster) <- c( "White","Black")
colnames(oyster) <- c( "No","Yes")
kbl(oyster) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 91 | 5 |
| Black | 114 | 0 |
filtered_data$oysteral <- as.factor(filtered_data$oyster.)
df1 = filtered_data %>%
count(race, oysteral) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = oysteral))+
geom_bar(aes(y = prop*100),
position = "dodge", stat = "identity") + scale_fill_discrete(name = "oyster allergy", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Race") + ggtitle("Figure 14. White Individuals Have Greater Proportion of Oyster Allergy") + theme(title = element_text(face="bold", size = 15))peanut <- table(filtered_data$pdemrace, filtered_data$Food.allergy..choice.peanut.)
fisher.test(peanut)##
## Fisher's Exact Test for Count Data
##
## data: peanut
## p-value = 0.07539
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.895861 5.702772
## sample estimates:
## odds ratio
## 2.175016
rownames(peanut) <- c( "White","Black")
colnames(peanut) <- c( "No","Yes")
kbl(peanut) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 87 | 9 |
| Black | 93 | 21 |
treenut <- table(filtered_data$pdemrace, filtered_data$Food.allergy..choice.tree.nut.)
fisher.test(treenut)##
## Fisher's Exact Test for Count Data
##
## data: treenut
## p-value = 0.6994
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.518347 2.828239
## sample estimates:
## odds ratio
## 1.196095
rownames(treenut) <- c( "White","Black")
colnames(treenut) <- c( "No","Yes")
kbl(treenut) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 83 | 13 |
| Black | 96 | 18 |
fish <- table(filtered_data$pdemrace, filtered_data$Food.allergy..choice.fish.)
fisher.test(fish)##
## Fisher's Exact Test for Count Data
##
## data: fish
## p-value = 0.355
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.6410381 3.3394545
## sample estimates:
## odds ratio
## 1.439202
rownames(fish) <- c( "White","Black")
colnames(fish) <- c( "No","Yes")
kbl(fish) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 83 | 13 |
| Black | 93 | 21 |
milk <- table(filtered_data$pdemrace, filtered_data$Food.allergy..choice.milk.)
fisher.test(milk)##
## Fisher's Exact Test for Count Data
##
## data: milk
## p-value = 0.7349
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.1276666 3.1801351
## sample estimates:
## odds ratio
## 0.6631358
rownames(milk) <- c( "White","Black")
colnames(milk) <- c( "No","Yes")
kbl(milk) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 91 | 5 |
| Black | 110 | 4 |
egg <- table(filtered_data$pdemrace, filtered_data$Food.allergy..choice.egg.)
fisher.test(egg)##
## Fisher's Exact Test for Count Data
##
## data: egg
## p-value = 0.1914
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.05603141 1.56617297
## sample estimates:
## odds ratio
## 0.3453331
rownames(egg) <- c( "White","Black")
colnames(egg) <- c( "No","Yes")
kbl(egg) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 89 | 7 |
| Black | 111 | 3 |
soy <- table(filtered_data$pdemrace, filtered_data$Food.allergy..choice.soy.)
fisher.test(soy)##
## Fisher's Exact Test for Count Data
##
## data: soy
## p-value = 0.5936
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.006995213 8.138635974
## sample estimates:
## odds ratio
## 0.4176305
rownames(soy) <- c( "White","Black")
colnames(soy) <- c( "No","Yes")
kbl(soy) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 94 | 2 |
| Black | 113 | 1 |
sesame <- table(filtered_data$pdemrace, filtered_data$Food.allergy..choice.sesame.)
rownames(sesame) <- c( "White","Black")
colnames(sesame) <- c( "No")
kbl(sesame) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | |
|---|---|
| White | 96 |
| Black | 114 |
wheat <- table(filtered_data$pdemrace, filtered_data$Food.allergy..choice.wheat.)
fisher.test(wheat)##
## Fisher's Exact Test for Count Data
##
## data: wheat
## p-value = 0.1808
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 0.004102636 2.117339256
## sample estimates:
## odds ratio
## 0.2049072
rownames(wheat) <- c( "White","Black")
colnames(wheat) <- c( "No","Yes")
kbl(wheat) %>%
kable_paper(full_width = F) %>% kable_styling(bootstrap_options = "striped", font_size = 15)| No | Yes | |
|---|---|---|
| White | 92 | 4 |
| Black | 113 | 1 |
filtered_data$wheatallergy <- as.factor(filtered_data$Food.allergy..choice.wheat.)
df1 = filtered_data %>%
count(race, wheatallergy) %>%
group_by(race) %>%
mutate(prop=prop.table(n))
ggplot(df1, aes(race, fill = wheatallergy))+
geom_bar(aes(y = prop*100),
position = "dodge", stat = "identity") + scale_fill_discrete(name = "wheat allergy", labels = c("No", "Yes"),type=c("cornflowerblue","red")) +theme_classic() + ylab("Proportion (%)") + xlab("Race") + ggtitle("Figure 15. Wheat Allergy Greater in White Individuals") + theme(title = element_text(face="bold", size = 15))