Creating Basic Charts with ggplot2
Code Example 2
Code
8 / 11
Code Example 2
Code
Code Example 2
r
site_enrollment <- prepared_data |>
distinct(participant_id, site) |>
count(site, name = "participants")
site_enrollment |>
ggplot(aes(x = reorder(site, participants), y = participants)) +
geom_col() +
coord_flip() +
labs(
title = "Participants Enrolled by Site",
x = "Site",
y = "Participants"
)