df |>mutate(`Date of birth`=as.Date(`Date of birth`, format ="%m/%d/%Y")) |># mutate(`Date of birth` = str_replace_all(`Date of birth`, "/", ""))unite(ChildID, `School code`, `Child code`, `Date of birth`, sep ="_") |>select(ChildID) |>group_by(ChildID) |>count() |>filter(n >1)|>kbl() |>kable_styling()
ChildID
n
25_a12_2007-01-27
2
26_17d_2010-12-03
2
38_9b10_2007-06-16
2
41_9c6_2007-10-11
2
63_9c20_2007-09-14
2
68_6b6_2010-06-23
2
73_8a9_2008-02-06
2
Task
Results: prevalencia de caries en niveles d1, d3 y d5 y DMFT, indicando diferencias por genero, region, place of living, lenguaje, para todos, 12 y 15 años
df |>select(`Place of living`, D1MFT, D3MFT, D5MFT) |>pivot_longer(-`Place of living`,names_to ="Index",values_to ="value") |>ggplot(aes(x =`Place of living`,y = value,fill = Index)) +scale_fill_viridis_d(begin =0.4) +# Use viridis color palettegeom_boxplot(outlier.color ='grey50', outlier.alpha =0.2) +labs(title ="Caries severity by place of living", fill ="Index", y ="Index value", x ="") +theme(legend.position ="top")
Model D1MFT by Place of living
Show the code
df %>%mutate(`Place of living`=fct_relevel(`Place of living`, "Rīga")) %>%glm(D1MFT ~`Place of living`, data = .) %>%tbl_regression() |>modify_caption("**D1MFT** (N = {N})")
D1MFT (N = 3129)
Characteristic
Beta
95% CI1
p-value
Place of living
Rīga
—
—
City
2.5
2.0, 3.0
<0.001
Lauki
2.8
2.2, 3.4
<0.001
Other City
1.6
1.1, 2.1
<0.001
Pierīga
0.23
-0.41, 0.87
0.5
1 CI = Confidence Interval
Model D3MFT by Place of living
Show the code
df %>%mutate(`Place of living`=fct_relevel(`Place of living`, "Rīga")) %>%glm(D3MFT ~`Place of living`, data = .) %>%tbl_regression() |>modify_caption("**D3MFT** (N = {N})")
D3MFT (N = 3129)
Characteristic
Beta
95% CI1
p-value
Place of living
Rīga
—
—
City
1.2
0.83, 1.5
<0.001
Lauki
1.3
0.91, 1.7
<0.001
Other City
0.50
0.16, 0.83
0.004
Pierīga
0.05
-0.37, 0.46
0.8
1 CI = Confidence Interval
Model D5MFT by Place of living
Show the code
df %>%mutate(`Place of living`=fct_relevel(`Place of living`, "Rīga")) %>%glm(D5MFT ~`Place of living`, data = .) %>%tbl_regression() |>modify_caption("**D5MFT** (N = {N})")
D5MFT (N = 3129)
Characteristic
Beta
95% CI1
p-value
Place of living
Rīga
—
—
City
0.66
0.37, 0.95
<0.001
Lauki
0.71
0.38, 1.0
<0.001
Other City
0.19
-0.09, 0.48
0.2
Pierīga
-0.09
-0.44, 0.27
0.6
1 CI = Confidence Interval
Show the code
df |>select( `Place of living`, D1MFT, D3MFT, D5MFT) |> gtsummary::tbl_summary(by =`Place of living`) |>add_ci() |>add_p()
✖ `add_ci()` added mean CI for "D1MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D1MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D1MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D1MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D1MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D3MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D3MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D3MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D3MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D3MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D5MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D5MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D5MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D5MFT"; however, no mean is shown in the `tbl_summary()` table.
✖ `add_ci()` added mean CI for "D5MFT"; however, no mean is shown in the `tbl_summary()` table.