Joining HR data

HR Analytics: Exploring Employee Data in R

Ben Teusch

HR Analytics Consultant

HR data systems

  • employee data
  • recruiting/ATS data
  • benefits data
  • compensation data
  • timekeeping data
  • payroll data
  • performance data
  • ... plus data from other business groups (Finance, IT, etc.)
HR Analytics: Exploring Employee Data in R

Joining HR Data

hr_data
 employee_id  department
           1 Engineering
           2       Sales
bonus_pay_data
 employee_id bonus_amount
           1         3000
           2        10000
left_join(hr_data, bonus_pay_data, by = "employee_id")
 employee_id  department bonus_amount
           1 Engineering         3000
           2       Sales        10000
HR Analytics: Exploring Employee Data in R

Using left_join()

hr_data
  employee_id  department
1           2 Engineering
2           3       Sales
3           4 Engineering
4           5     Finance
bonus_pay_data
  employee_id bonus_amount
1           1         3000
2           2        10000
3           3         2500
4           5         4000
left_join(hr_data, bonus_pay_data, by = "employee_id")
  employee_id  department bonus_amount
1           2 Engineering        10000
2           3       Sales         2500
3           4 Engineering           NA
4           5     Finance         4000
HR Analytics: Exploring Employee Data in R

Other joins

To learn more about other joins, refer to Joining Data in R with dplyr

HR Analytics: Exploring Employee Data in R

Choosing a key for joining

  • Use unique identifiers such as employee id when joining data frames
  • Avoid using names
HR Analytics: Exploring Employee Data in R

Let's practice!

HR Analytics: Exploring Employee Data in R

Preparing Video For Download...