Create salary hike range
As discussed in the video, you will now classify percent_hike
into the following categories for employees who are at Analyst level:
0 to 10
, if 0 <=percent_hike
<= 1011 to 15
, if 11 <=percent_hike
<= 1516 to 20
, if 16 <=percent_hike
<= 20
This exercise is part of the course
HR Analytics: Predicting Employee Churn in R
Exercise instructions
- Plot a histogram of the
percent_hike
column. - Subset the
emp_final
dataset to contain employees atAnalyst
level and classifypercent_hike
as per the conditions mentioned above.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Plot histogram of percent hike
ggplot(emp_final, aes(x = ___)) +
___(binwidth = 3)
# Create salary hike_range of Analyst level employees
emp_hike_range <- emp_final %>%
___(level == "___") %>%
mutate(hike_range = ___(___, breaks = c(0, 10, 15, 20),
include.lowest = TRUE,
labels = c("0 to 10",
"11 to 15", "16 to 20")))