Bringing in more data
Since overtime hours didn't have a significant change between the years, you should see what other variables you can check. In consulting with your team, somebody suggests trying engagement scores, and specifically the number of disengaged employees at the location. You don't have the survey data ready yet, so you'll need to load it in and join it to the data you've been working with. Performing multiple joins is common in HR analytics.
After the join, change year
to factor(year)
. Since you only care about the year as a grouping variable, and not its actual numeric value, changing it to a factor will make further analysis easier.
Este exercício faz parte do curso
HR Analytics: Exploring Employee Data in R
Instruções do exercício
- Import
"survey_data_2.csv"
assurvey_data
usingread_csv()
. - Use
left_join()
to add the engagement data tohr_joined
. Join on year followed by employee ID. - Using
%>%
after the join, usemutate()
to adddisengaged
, which is 1 whenengagement
is 2 or less, and 0 otherwise; and replaceyear
withfactor(year)
. Assign the result of these steps tosafety
.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Import the survey data
survey_data <- ___
# Create the safety dataset
safety <- ___