tbl.demo <- df.yrbs.ad %>%select( age, sex, race_cat, height, weight, bmi, grade, e_bullied, fight_cat, gaming_cat, unsafe_school, active) %>% gtsummary::tbl_summary(by = sex,type =list(age ~"continuous", active ~"continuous"),percent ="row",statistic =list(all_continuous() ~"{mean} ({sd})",all_categorical() ~"{n} ({p}%)" ),label =list(age ="Age (years)",sex ="Sex",race_cat ="Race",height ="Height (meter)",weight ="Weight (kilogram)",bmi ="Body mass index",grade ="Grade at school",e_bullied ="Electronical bullying in last 12 months",fight_cat ="Physical fight in last 12 months",gaming_cat ="Computer use during school days (e.g., gaming)",unsafe_school ="Days of no school during last 30 days",active ="Physically active past 7 days (≥ 60min)"),missing_text ="Missing",missing_stat ="{N_miss} ({p_miss}%)",missing ="ifany",digits =all_continuous() ~2 ) %>%add_overall(last =TRUE) %>%bold_labels()tbl.demo %>%as_flex_table() %>%autofit() %>%bold(part ="header") %>%align(j =1, align ="left", part ="all")
Participant characteristics
Characteristic
Male N = 6,6411
Female N = 6,8851
Missing N = 1511
Overall N = 13,6771
Age (years)
16.00 (1.24)
15.89 (1.23)
14.95 (1.76)
15.94 (1.24)
Missing
9 (0.1%)
6 (<0.1%)
57 (38%)
72 (0.5%)
Race
White
3,244 (49%)
3,398 (51%)
26 (0.4%)
6,668 (100%)
Hispanic incl. multiple Hisp.
1,466 (48%)
1,563 (51%)
9 (0.3%)
3,038 (100%)
Black or African American
1,010 (50%)
1,024 (50%)
6 (0.3%)
2,040 (100%)
Other
722 (48%)
756 (51%)
15 (1.0%)
1,493 (100%)
Missing
199 (3.0%)
144 (2.1%)
95 (63%)
438 (3.2%)
Height (meter)
1.76 (0.08)
1.63 (0.07)
NA (NA)
1.69 (0.10)
Missing
677 (10%)
709 (10%)
151 (100%)
1,537 (11%)
Weight (kilogram)
73.64 (18.49)
62.38 (15.13)
NA (NA)
67.91 (17.78)
Missing
677 (10%)
709 (10%)
151 (100%)
1,537 (11%)
Body mass index
23.73 (5.41)
23.50 (5.33)
NA (NA)
23.61 (5.37)
Missing
677 (10%)
709 (10%)
151 (100%)
1,537 (11%)
Grade at school
9
1,716 (47%)
1,902 (52%)
19 (0.5%)
3,637 (100%)
10
1,837 (49%)
1,853 (50%)
27 (0.7%)
3,717 (100%)
11
1,651 (50%)
1,657 (50%)
14 (0.4%)
3,322 (100%)
12
1,391 (49%)
1,440 (51%)
19 (0.7%)
2,850 (100%)
other
18 (46%)
14 (36%)
7 (18%)
39 (100%)
Missing
28 (0.4%)
19 (0.3%)
65 (43%)
112 (0.8%)
Electronical bullying in last 12 months
694 (32%)
1,400 (65%)
44 (2.1%)
2,138 (100%)
Missing
96 (1.4%)
66 (1.0%)
30 (20%)
192 (1.4%)
Physical fight in last 12 months
0 times
3,738 (45%)
4,591 (55%)
58 (0.7%)
8,387 (100%)
1 time
628 (58%)
447 (41%)
9 (0.8%)
1,084 (100%)
2-3 times
491 (63%)
274 (35%)
12 (1.5%)
777 (100%)
4-5 times
144 (63%)
79 (35%)
4 (1.8%)
227 (100%)
6-7 times
64 (74%)
22 (25%)
1 (1.1%)
87 (100%)
8-9 times
27 (73%)
8 (22%)
2 (5.4%)
37 (100%)
10-11 times
15 (75%)
5 (25%)
0 (0%)
20 (100%)
≥12 times
120 (79%)
28 (18%)
4 (2.6%)
152 (100%)
Missing
1,414 (21%)
1,431 (21%)
61 (40%)
2,906 (21%)
Computer use during school days (e.g., gaming)
Not at all
842 (35%)
1,558 (64%)
26 (1.1%)
2,426 (100%)
<1 hours per day
755 (52%)
663 (46%)
21 (1.5%)
1,439 (100%)
1 hour per day
744 (55%)
599 (44%)
14 (1.0%)
1,357 (100%)
2 hours per day
1,060 (52%)
950 (47%)
14 (0.7%)
2,024 (100%)
3 hours per day
1,032 (51%)
964 (48%)
23 (1.1%)
2,019 (100%)
4 hours per day
652 (51%)
624 (48%)
11 (0.9%)
1,287 (100%)
≥5 hours per day
1,253 (48%)
1,345 (51%)
27 (1.0%)
2,625 (100%)
Missing
303 (4.6%)
182 (2.6%)
15 (9.9%)
500 (3.7%)
Days of no school during last 30 days
0 days
6,076 (49%)
6,164 (50%)
91 (0.7%)
12,331 (100%)
1 day
241 (39%)
365 (59%)
9 (1.5%)
615 (100%)
2 or 3 days
153 (38%)
233 (58%)
16 (4.0%)
402 (100%)
4 or 5 days
50 (49%)
49 (48%)
3 (2.9%)
102 (100%)
≥6 days
86 (57%)
54 (36%)
11 (7.3%)
151 (100%)
Missing
35 (0.5%)
20 (0.3%)
21 (14%)
76 (0.6%)
Physically active past 7 days (≥ 60min)
4.12 (2.54)
3.28 (2.43)
3.47 (2.60)
3.69 (2.52)
Missing
270 (4.1%)
175 (2.5%)
12 (7.9%)
457 (3.3%)
1Mean (SD); n (%)
Code
tbl.demo.docx <- tbl.demotbl.demo.docx %>%as_flex_table() %>%set_caption("Table. Participant characteristics, separated by sex.") %>% flextable::set_table_properties(width =1, layout ="autofit") %>% flextable::fontsize(size =8, part ="all") %>% flextable::font(fontname ="Times New Roman", part ="all") %>% flextable::save_as_docx(path ="../tables/table1.docx")
0 days 1 day 2 or 3 days 4 or 5 days ≥6 days
Male 4552 169 98 29 53
Female 4704 281 179 31 36
Code
param_order <-c("Gaming: ≥1 hour per day","Age","Sex: Female","Race: Black or African American","Race: Hispanic incl. multiple Hisp.","Race: Other","Physically active (≥ 60min/d in previous 7 days)","Unsafe school: 1 day","Unsafe school: 2 or 3 days","Unsafe school: 4 or 5 days","Unsafe school: ≥ 6 days")glm.combined.wide <- glm.model1.final %>%rename(`OR Model 1`=`Odds Ratio`,`95% CI Model 1`=`95% CI`) %>%full_join( glm.model2.final %>%rename(`OR Model 2`=`Odds Ratio`,`95% CI Model 2`=`95% CI` ),by ="Parameter") %>%full_join( glm.model3.final %>%rename(`OR Model 3`=`Odds Ratio`,`95% CI Model 3`=`95% CI` ),by ="Parameter") %>%mutate(Parameter =factor(Parameter, levels = param_order)) %>%arrange(Parameter)# Combined tableft.combined <-flextable(glm.combined.wide) ft.combined %>%autofit() %>%bold(part ="header") %>%align(align ="center", part ="all")
Parameter
OR Model 1
95% CI Model 1
OR Model 2
95% CI Model 2
OR Model 3
95% CI Model 3
Gaming: ≥1 hour per day
1.04
0.94 – 1.16
0.95
0.86 – 1.06
0.97
0.87 – 1.09
Age
0.86
0.82 – 0.89
0.86
0.83 – 0.9
Sex: Female
0.45
0.41 – 0.5
0.45
0.41 – 0.5
Race: Black or African American
1.85
1.61 – 2.12
1.83
1.59 – 2.11
Race: Hispanic incl. multiple Hisp.
1.23
1.09 – 1.38
1.18
1.05 – 1.34
Race: Other
1.27
1.09 – 1.49
1.25
1.06 – 1.46
Physically active (≥ 60min/d in previous 7 days)
1.04
1.02 – 1.06
Unsafe school: 1 day
2.15
1.74 – 2.65
Unsafe school: 2 or 3 days
2.91
2.25 – 3.75
Unsafe school: 4 or 5 days
3.61
2.12 – 6.1
Unsafe school: ≥ 6 days
5.67
3.67 – 8.86
Code
ft.combined %>%autofit() %>%bold(part ="header") %>%align(align ="center", part ="all") %>%fontsize(size =8, part ="all") %>%font(fontname ="Times New Roman", part ="all") %>%set_caption("Table. Association between gaming and fighting (Models 1, 2 and 3)") %>% flextable::save_as_docx(path ="../tables/ft.model.combined.docx")