CLiREN-LMS
Data Visualization and Dashboards

Creating Basic Charts with ggplot2

Code Example 3

30-45 minutes Applied Step 9 of 11
Code

Code Example 3

9 / 11
Code

Code Example 3

r

prepared_data |>
  ggplot(aes(x = age_years_derived)) +
  geom_histogram(binwidth = 5, boundary = 0, color = "white") +
  labs(
    title = "Age Distribution at Enrollment",
    x = "Age, years",
    y = "Number of participants"
  )