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
.
This exercise is part of the course
HR Analytics: Predicting Employee Churn in R
Exercise instructions
- Subtract
emp_age
frommgr_age
to create a new variable,age_diff
. - Generate a box plot to visualize this age difference for
Active
andInactive
employees.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Add age_diff
emp_age_diff <- org_final %>%
___(age_diff = ___ - emp_age)
# Plot the distribution of age difference
ggplot(___, aes(x = ___, y = ___)) +
geom_boxplot()