Created
January 3, 2020 19:32
-
-
Save dgkeyes/5d68359fa4453a0cec3d105d98fb7859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
outputs <- read_excel(path = "data-raw/outputs_profservcices.xlsx") %>% | |
mutate(hours_counted = case_when( | |
activity == "Output" ~ hours, | |
activity == "A la Carte Referral" & prosper_approved == "Yes" ~ hours, | |
activity == "SBLC Referral" & accepted == "Yes" ~ hours, | |
activity == "MFS Referral" & accepted == "Yes" ~ hours, | |
activity == "MarketLink Referral" & accepted == "Yes" ~ hours | |
)) %>% | |
mutate(activity_categorized = case_when( | |
activity == "Output" ~ "Output", | |
TRUE ~ "Referral" | |
)) | |
outputs_hours <- outputs %>% | |
group_by(clientid, activity_categorized) %>% | |
summarize(total_hours = sum(hours_counted)) | |
outputs_referrals <- outputs %>% | |
filter(activity != "Output") %>% | |
mutate(activity_approved = case_when( | |
activity == "A la Carte Referral" & prosper_approved == "Yes" ~ "Yes", | |
activity == "SBLC Referral" & accepted == "Yes" ~ "Yes", | |
activity == "MFS Referral" & accepted == "Yes" ~ "Yes", | |
activity == "MarketLink Referral" & accepted == "Yes" ~ "Yes" | |
)) %>% | |
filter(activity_approved == "Yes") %>% | |
count(clientid, | |
name = "number_of_referrals") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment