Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Last active June 20, 2025 16:21
Show Gist options
  • Save thinkphp/905c2be6583964309eae5e552b6f1290 to your computer and use it in GitHub Desktop.
Save thinkphp/905c2be6583964309eae5e552b6f1290 to your computer and use it in GitHub Desktop.
part 3. question 3
#question 3:
completion_by_age <- traning_clean %>%
mutate(
age_bin = case_when(
age >= 18 & age <= 25 ~ "18-25",
age >= 26 & age <= 45 ~ "26-45",
age >= 46 & age <= 65 ~ "46-65"
)
) %>%
filter(!is.na(age_bin)) %>%
group_by(age_bin) %>%
summarise(
completion_rate = mean(program_status_clean == "Completed and Passed", na.rm = TRUE) * 100
)
print(completion_by_age)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment