CommencerCommencer gratuitement

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 <= 10
  • 11 to 15, if 11 <= percent_hike <= 15
  • 16 to 20, if 16 <= percent_hike <= 20

Cet exercice fait partie du cours

HR Analytics: Predicting Employee Churn in R

Afficher le cours

Instructions

  • Plot a histogram of the percent_hike column.
  • Subset the emp_final dataset to contain employees at Analyst level and classify percent_hike as per the conditions mentioned above.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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")))
Modifier et exécuter le code