-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable3&4.R
274 lines (208 loc) · 18.7 KB
/
table3&4.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# Table 3 & 4
library(tidyverse)
library(survival) # coxph
library(survminer) # coxph
library(stringr)
library(reshape2)
library(qgcomp)
library(naniar)
library(rms)
library(lmtest)
library(qgcompint)
# Load data ---
dataBC <- read_csv("clean_data/dataBC.csv")
dataOv <- read_csv("clean_data/dataOv.csv")
dataUE <- read_csv("clean_data/dataUE.csv")
covs1 <- c("race","educ", "income","menopause", "smoking", "alcohol","BCduration", "HRT1", "PA", "BMI")
covs2 <- c("race","educ", "income","menopause", "smoking", "alcohol","BCduration", "HRT2", "PA", "BMI")
productname = c('blush', 'eyeliner', 'eyeshadow', 'foundation', 'lipstick', 'mascara', 'makeupremover',
'perfume', 'artificialnail', 'cuticlecream', 'nailpolish', 'nailremover',
'bathgel', 'deodorant', 'douche', 'mouthwash', 'shavingcream', 'talcarm', 'talcvaginal', 'talcother',
'antiaging', 'agespotlightener', 'babyoil', 'blemish', 'bodylotion', 'cleansing', 'facecream', 'mask',
'footcream', 'handlotion', 'moisturizer','petroleumjelly', 'skinlightener', 'tanner')
# Breast Cancer ---
dat1 <- dataBC %>%
filter_at(vars(all_of(covs1), "AgeExact_Baseline", "FU_BCInvD_EOFAgeExact", "FU_BCInvD_Event"), all_vars(!is.na(.)))%>%
mutate_at(vars("race","educ","income", "menopause", "smoking", "alcohol", "BCduration", "HRT1"), factor)%>%
mutate(BMI_3c = case_when(BMI<25 ~ 0,
BMI>=25 & BMI<30 ~ 1,
BMI>=30 ~ 2))
# Ovarian Cancer ---
dat2 <- dataOv %>%
filter_at(vars(all_of(covs1), "AgeExact_Baseline", "FU_OvCa_EOFAgeExact_ooph", "FU_OvCa_Event"), all_vars(!is.na(.)))%>%
mutate_at(vars("race","educ","income", "menopause", "smoking", "alcohol", "BCduration", "HRT1"), factor)%>%
mutate(BMI_3c = case_when(BMI<25 ~ 0,
BMI>=25 & BMI<30 ~ 1,
BMI>=30 ~ 2))
# Uterine Cancer ---
dat3 <- dataUE %>%
filter_at(vars(all_of(covs2), "AgeExact_Baseline", "FU_UECa_EOFAgeExact_hyst", "FU_UECa_Event"), all_vars(!is.na(.)))%>%
mutate_at(vars("race","educ","income", "menopause", "smoking", "alcohol", "BCduration", "HRT2"), factor)%>%
mutate(BMI_3c = case_when(BMI<25 ~ 0,
BMI>=25 & BMI<30 ~ 1,
BMI>=30 ~ 2))
# Race ----
## Black ----
# Beauty
ex <- c('blush', 'eyeliner', 'eyeshadow', 'foundation', 'lipstick', 'mascara', 'makeupremover',
'perfume', 'artificialnail', 'cuticlecream', 'nailpolish', 'nailremover')
# Use the function in function.R' please run the function codes in function.R first.
# from here; make the # right
dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(race) %>% summarise(n=n(), n_event=sum(FU_BCInvD_Event), py=sum(FU_BCInvD_EOFAgeExact - AgeExact_Baseline))
dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(race) %>% summarise(n=n(), n_event=sum(FU_OvCa_Event), py=sum(FU_OvCa_EOFAgeExact_ooph - AgeExact_Baseline))
dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(race) %>% summarise(n=n(), n_event=sum(FU_UECa_Event), py=sum(FU_UECa_EOFAgeExact_hyst - AgeExact_Baseline))
BC1 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="1")) %>% BC_race_fun()
Ov1 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="1")) %>% Ov_race_fun()
UE1 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="1")) %>% UE_race_fun()
# Hygiene
ex <- c('bathgel', 'deodorant', 'douche', 'mouthwash', 'shavingcream', 'talcarm', 'talcvaginal', 'talcother')
dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(race) %>% summarise(n=n(), n_event=sum(FU_BCInvD_Event), py=sum(FU_BCInvD_EOFAgeExact - AgeExact_Baseline))
dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(race) %>% summarise(n=n(), n_event=sum(FU_OvCa_Event), py=sum(FU_OvCa_EOFAgeExact_ooph - AgeExact_Baseline))
dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(race) %>% summarise(n=n(), n_event=sum(FU_UECa_Event), py=sum(FU_UECa_EOFAgeExact_hyst - AgeExact_Baseline))
# Use the function in function.R' please run the function codes in function.R first.
BC2 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="1")) %>% BC_race_fun()
Ov2 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="1")) %>% Ov_race_fun()
UE2 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="1")) %>% UE_race_fun()
# Skincare
ex <- c('antiaging', 'agespotlightener', 'babyoil', 'blemish', 'bodylotion', 'cleansing', 'facecream', 'mask',
'footcream', 'handlotion', 'moisturizer','petroleumjelly', 'skinlightener', 'tanner')
dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(race) %>% summarise(n=n(), n_event=sum(FU_BCInvD_Event), py=sum(FU_BCInvD_EOFAgeExact - AgeExact_Baseline))
dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(race) %>% summarise(n=n(), n_event=sum(FU_OvCa_Event), py=sum(FU_OvCa_EOFAgeExact_ooph - AgeExact_Baseline))
dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(race) %>% summarise(n=n(), n_event=sum(FU_UECa_Event), py=sum(FU_UECa_EOFAgeExact_hyst - AgeExact_Baseline))
# Use the function in function.R' please run the function codes in function.R first.
BC3 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="1")) %>% BC_race_fun()
Ov3 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="1")) %>% Ov_race_fun()
ex <- c('antiaging', 'babyoil', 'blemish', 'bodylotion', 'cleansing', 'facecream', 'mask',
'footcream', 'handlotion', 'moisturizer','petroleumjelly')
UE3 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="1")) %>% UE_race_fun()
## White ----
# Beauty
ex <- c('blush', 'eyeliner', 'eyeshadow', 'foundation', 'lipstick', 'mascara', 'makeupremover',
'perfume', 'artificialnail', 'cuticlecream', 'nailpolish', 'nailremover')
# Use the function in function.R' please run the function codes in function.R first.
# from here; make the # right
BC1 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="0")) %>% BC_race_fun()
Ov1 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="0")) %>% Ov_race_fun()
UE1 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="0")) %>% UE_race_fun()
# Hygiene
ex <- c('bathgel', 'deodorant', 'douche', 'mouthwash', 'shavingcream', 'talcarm', 'talcvaginal', 'talcother')
# Use the function in function.R' please run the function codes in function.R first.
BC2 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="0")) %>% BC_race_fun()
Ov2 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="0")) %>% Ov_race_fun()
UE2 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="0")) %>% UE_race_fun()
# Skincare
ex <- c('antiaging', 'agespotlightener', 'babyoil', 'blemish', 'bodylotion', 'cleansing', 'facecream', 'mask',
'footcream', 'handlotion', 'moisturizer','petroleumjelly', 'skinlightener', 'tanner')
# Use the function in function.R' please run the function codes in function.R first.
BC3 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="0")) %>% BC_race_fun()
Ov3 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="0")) %>% Ov_race_fun()
UE3 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1)) %>% mutate(race=relevel(race, ref="0")) %>% UE_race_fun()
## P-for-interaction for race ----
# Beauty
ex <- c('blush', 'eyeliner', 'eyeshadow', 'foundation', 'lipstick', 'mascara', 'makeupremover',
'perfume', 'artificialnail', 'cuticlecream', 'nailpolish', 'nailremover')
BC1_inter <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1))%>% BC_race_pinter_fun()
Ov1_inter <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1))%>% Ov_race_pinter_fun()
UE1_inter <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1))%>% UE_race_pinter_fun()
# Hygiene
ex <- c('bathgel', 'deodorant', 'douche', 'mouthwash', 'shavingcream', 'talcarm', 'talcvaginal', 'talcother')
BC2_inter <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1))%>% BC_race_pinter_fun()
Ov2_inter <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1))%>% Ov_race_pinter_fun()
UE2_inter <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1))%>% UE_race_pinter_fun()
# Skincare
ex <- c('antiaging', 'agespotlightener', 'babyoil', 'blemish', 'bodylotion', 'cleansing', 'facecream', 'mask',
'footcream', 'handlotion', 'moisturizer','petroleumjelly', 'skinlightener', 'tanner')
BC3_inter <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1))%>% BC_race_pinter_fun()
Ov3_inter <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1))%>% Ov_race_pinter_fun()
UE3_inter <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% filter(race%in%c(0,1))%>% UE_race_pinter_fun()
# BMI ----
## <25 ----
# Beauty
ex <- c('blush', 'eyeliner', 'eyeshadow', 'foundation', 'lipstick', 'mascara', 'makeupremover',
'perfume', 'artificialnail', 'cuticlecream', 'nailpolish', 'nailremover')
# Use the function in function.R' please run the function codes in function.R first.
# from here; make the # right
dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_BCInvD_Event), py=sum(FU_BCInvD_EOFAgeExact - AgeExact_Baseline))
dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_OvCa_Event), py=sum(FU_OvCa_EOFAgeExact_ooph - AgeExact_Baseline))
dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_UECa_Event), py=sum(FU_UECa_EOFAgeExact_hyst - AgeExact_Baseline))
BC1 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="0")) %>% BC_3BMI_fun()
Ov1 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="0")) %>% Ov_3BMI_fun()
UE1 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="0")) %>% UE_3BMI_fun()
# Hygiene
ex <- c('bathgel', 'deodorant', 'douche', 'mouthwash', 'shavingcream', 'talcarm', 'talcvaginal', 'talcother')
dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_BCInvD_Event), py=sum(FU_BCInvD_EOFAgeExact - AgeExact_Baseline))
dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_OvCa_Event), py=sum(FU_OvCa_EOFAgeExact_ooph - AgeExact_Baseline))
dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_UECa_Event), py=sum(FU_UECa_EOFAgeExact_hyst - AgeExact_Baseline))
BC2 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="0")) %>% BC_3BMI_fun()
Ov2 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="0")) %>% Ov_3BMI_fun()
UE2 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="0")) %>% UE_3BMI_fun()
# Skincare
ex <- c('antiaging', 'agespotlightener', 'babyoil', 'blemish', 'bodylotion', 'cleansing', 'facecream', 'mask',
'footcream', 'handlotion', 'moisturizer','petroleumjelly', 'skinlightener', 'tanner')
dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_BCInvD_Event), py=sum(FU_BCInvD_EOFAgeExact - AgeExact_Baseline))
dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_OvCa_Event), py=sum(FU_OvCa_EOFAgeExact_ooph - AgeExact_Baseline))
dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_UECa_Event), py=sum(FU_UECa_EOFAgeExact_hyst - AgeExact_Baseline))
BC3 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="0")) %>% BC_3BMI_fun()
Ov3 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="0")) %>% Ov_3BMI_fun()
UE3 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="0")) %>% UE_3BMI_fun()
## >=25 and <30 ----
# Beauty
ex <- c('blush', 'eyeliner', 'eyeshadow', 'foundation', 'lipstick', 'mascara', 'makeupremover',
'perfume', 'artificialnail', 'cuticlecream', 'nailpolish', 'nailremover')
# Use the function in function.R' please run the function codes in function.R first.
# from here; make the # right
BC1 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="1")) %>% BC_3BMI_fun()
Ov1 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="1")) %>% Ov_3BMI_fun()
UE1 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="1")) %>% UE_3BMI_fun()
# Hygiene
ex <- c('bathgel', 'deodorant', 'douche', 'mouthwash', 'shavingcream', 'talcarm', 'talcvaginal', 'talcother')
BC2 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="1")) %>% BC_3BMI_fun()
Ov2 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="1")) %>% Ov_3BMI_fun()
UE2 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="1")) %>% UE_3BMI_fun()
# Skincare
ex <- c('antiaging', 'agespotlightener', 'babyoil', 'blemish', 'bodylotion', 'cleansing', 'facecream', 'mask',
'footcream', 'handlotion', 'moisturizer','petroleumjelly', 'skinlightener', 'tanner')
BC3 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="1")) %>% BC_3BMI_fun()
Ov3 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="1")) %>% Ov_3BMI_fun()
UE3 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="1")) %>% UE_3BMI_fun()
## >=30 ----
# Beauty
ex <- c('blush', 'eyeliner', 'eyeshadow', 'foundation', 'lipstick', 'mascara', 'makeupremover',
'perfume', 'artificialnail', 'cuticlecream', 'nailpolish', 'nailremover')
# Use the function in function.R' please run the function codes in function.R first.
# from here; make the # right
BC1 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="2")) %>% BC_3BMI_fun()
Ov1 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="2")) %>% Ov_3BMI_fun()
UE1 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="2")) %>% UE_3BMI_fun()
# Hygiene
ex <- c('bathgel', 'deodorant', 'douche', 'mouthwash', 'shavingcream', 'talcarm', 'talcvaginal', 'talcother')
BC2 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="2")) %>% BC_3BMI_fun()
Ov2 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="2")) %>% Ov_3BMI_fun()
UE2 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="2")) %>% UE_3BMI_fun()
# Skincare
ex <- c('antiaging', 'agespotlightener', 'babyoil', 'blemish', 'bodylotion', 'cleansing', 'facecream', 'mask',
'footcream', 'handlotion', 'moisturizer','petroleumjelly', 'skinlightener', 'tanner')
dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_BCInvD_Event))
dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_OvCa_Event))
dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% group_by(BMI_3c) %>% summarise(n=n(), n_event=sum(FU_UECa_Event))
BC3 <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="2")) %>% BC_3BMI_fun()
Ov3 <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="2")) %>% Ov_3BMI_fun()
UE3 <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% mutate(BMI_3c=relevel(as.factor(BMI_3c), ref="2")) %>% UE_3BMI_fun()
## P-for-interaction for BMI ----
# Beauty
ex <- c('blush', 'eyeliner', 'eyeshadow', 'foundation', 'lipstick', 'mascara', 'makeupremover',
'perfume', 'artificialnail', 'cuticlecream', 'nailpolish', 'nailremover')
BC1_inter <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% BC_3BMI_pinter_fun()
Ov1_inter <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% Ov_3BMI_pinter_fun()
UE1_inter <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% UE_3BMI_pinter_fun()
# Hygiene
ex <- c('bathgel', 'deodorant', 'douche', 'mouthwash', 'shavingcream', 'talcarm', 'talcvaginal', 'talcother')
BC2_inter <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% BC_3BMI_pinter_fun()
Ov2_inter <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% Ov_3BMI_pinter_fun()
UE2_inter <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% UE_3BMI_pinter_fun()
# Skincare
ex <- c('antiaging', 'agespotlightener', 'babyoil', 'blemish', 'bodylotion', 'cleansing', 'facecream', 'mask',
'footcream', 'handlotion', 'moisturizer','petroleumjelly', 'skinlightener', 'tanner')
BC3_inter <- dat1 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% BC_3BMI_pinter_fun()
Ov3_inter <- dat2 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% Ov_3BMI_pinter_fun()
UE3_inter <- dat3 %>% filter_at(all_of(ex), all_vars(!is.na(.))) %>% UE_3BMI_pinter_fun()