Derive age difference
Different generations of the workforce have different views and opinions towards managing and delivering work and handling pressure.
New generation managers need to learn to motivate and manage the pool of older workers. Employees reporting to younger managers generally report overconfidence, lack of respect and inexperience of manager as a reason of turnover while as per younger managers, older employees wallow in their past achievements and do not accept the pace of change in work environment.
In this exercise, you'll calculate the age difference between employees and their respective managers and explore this distribution of age difference between Active and Inactive employees.
Manager age (mgr_age) and employee age (emp_age) are available in org_final.
本练习是课程的一部分
HR Analytics: Predicting Employee Churn in R
练习说明
- Subtract
emp_agefrommgr_ageto create a new variable,age_diff. - Generate a box plot to visualize this age difference for
ActiveandInactiveemployees.
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Add age_diff
emp_age_diff <- org_final %>%
___(age_diff = ___ - emp_age)
# Plot the distribution of age difference
ggplot(___, aes(x = ___, y = ___)) +
geom_boxplot()