Get startedGet started for free

Cost versus urgency

The dataset vacancies_impact we just created contains the total_cost and cost_impact for each case, but it also contains a data attribute urgency, which indicates whether the vacancy is urgent (urgency == 10) or not (urgency == 1). Use dplyr's case_when() to create the variable cost_profile, which indicates whether costs where incurred appropriately:

  • Disproportionate if cost_impact == High and urgency less than 7
  • Excessive if cost_impact == Medium, and urgency less than 5
  • Lacking if cost_impact == Low and urgency is greater than 6
  • Appropriate otherwise

This exercise is part of the course

Business Process Analytics in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create cost_profile
vacancies_profile <- vacancies_impact %>%
  mutate(
    cost_profile = case_when(
      cost_impact == "High" & urgency < 7 ~ "Disproportionate",
      ___
      ___
      TRUE ~ "Appropriate"
    )
  )
Edit and Run Code