开始使用免费开始使用

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

本练习是课程的一部分

HR Analytics: Predicting Employee Churn in R

查看课程

练习说明

  • 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.

交互式实操练习

通过完成这段示例代码来试试这个练习。

# 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")))
编辑并运行代码