Enrollment and Follow-Up Monitoring Plots
Code Example 2
Code
7 / 10
Code Example 2
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"
)