Demographics visualizations

if (!('home_visit_df' %in% ls())) {
  targets::tar_load(home_visit_df, store="../_targets")
}

Child age

Child age in months (age_group) by child_sex.

Note: The child’s exact age in months is part of the Databrary-related data. That is on the work plan.

home_visit_filtered <- home_visit_df |>
  dplyr::filter(!is.na(age_group),
                !is.na(child_sex))
xtabs(formula = ~ age_group + child_sex, 
      data = home_visit_filtered)
##          child_sex
## age_group female male
##      12mo    144  122
##      18mo    129  149
##      24mo    109  113

A total of \(n=\) 766 mother-infant dyads have been tested. This includes training and pilot visits.

home_visit_filtered |>
  ggplot() +
  aes(age_group, fill = child_sex) +
  geom_bar() +
  theme(legend.position = "bottom") +
  theme(legend.title = element_blank())
Participants by age group and sex

Figure 4: Participants by age group and sex

Time series

To calculate cumulative visits, we have to add an index variable

df <- home_visit_filtered |>
  dplyr::select(test_date, site_id) |>
  dplyr::mutate(test_date = as.Date(test_date)) |>
  dplyr::arrange(test_date) |>
  dplyr::mutate(n_visits = seq_along(test_date))
df |>
  dplyr::filter(!is.na(test_date),
                !is.na(n_visits),
                !is.na(site_id)) |>
  ggplot() +
  aes(test_date, n_visits) +
  geom_point()
Cumulative home visits by year

Figure 5: Cumulative home visits by year