CLiREN-LMS
Data Visualization and Dashboards

Creating Basic Charts with ggplot2

Code Example 2

30-45 minutes Applied Step 8 of 11
Code

Code Example 2

8 / 11
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"
  )