Exercise

Derive employee tenure

In this exercise, you'll derive employee tenure within the organization, i.e., the length of time an employee worked/has been in the organization.

In order to find the time difference between two dates, you can use the interval() and time_length() functions from lubridate. We have already converted the relevant date columns from character to date format.

Remember cutoff_date is used to calculate the tenure of Active employees while last_working_date is used for Inactive employees.

Instructions

100 XP
  • Derive tenure of employees in years using last_working_date, date_of_joining and cutoff_date.
  • Generate a box plot to visualize employee tenure for Active and Inactive employees.