Get startedGet started for free

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.

This exercise is part of the course

HR Analytics: Exploring Employee Data in R

View Course

Exercise instructions

  • Import "survey_data_2.csv" as survey_data using read_csv().
  • Use left_join() to add the engagement data to hr_joined. Join on year followed by employee ID.
  • Using %>% after the join, use mutate() to add disengaged, which is 1 when engagement is 2 or less, and 0 otherwise; and replace year with factor(year). Assign the result of these steps to safety.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Import the survey data
survey_data <- ___

# Create the safety dataset
safety <- ___

Edit and Run Code