CLiREN-LMS
Data Visualization and Dashboards

Enrollment and Follow-Up Monitoring Plots

Code Example 2

30-45 minutes Applied Step 7 of 10
Code

Code Example 2

7 / 10
Code

Code Example 2

r

site_cumulative_enrollment <- prepared_data |>
  distinct(participant_id, enrollment_date, site) |>
  arrange(site, enrollment_date) |>
  group_by(site) |>
  mutate(cumulative_participants = row_number()) |>
  ungroup()

site_cumulative_enrollment |>
  ggplot(aes(x = enrollment_date, y = cumulative_participants, color = site)) +
  geom_line() +
  labs(
    title = "Cumulative Enrollment by Site",
    x = "Enrollment date",
    y = "Cumulative participants",
    color = "Site"
  )