R Tutorial: Exploring the data

Walk through an employee turnover dataset in R, computing the overall turnover rate at 18% and breaking it down by job level. Analyst and specialist positions show the highest turnover, visualized with ggplot2.
Chapters
Data exploration is the first step in understanding your data. Here is a quick view of the data set you just imported. Employee ID is a unique identifier for each employee. Status shows employment status of an employee. If an employee is currently working in an organization, they are marked as active, while if an employee has left the organization their status is marked as inactive. The same also reflects in the turnover variable where 0 stands for active and 1 for inactive for inactive employees. The last working date in the organization is stored in last working date column. For all active employees, you will be using cutoff date which is the study period end date. Let's go ahead and calculate turnover rate to drive insights from the data. Turnover rate is the percentage of employees who left the organization in a given period of time. To calculate turnover rate you need two numbers. The number of employees who left the organization during that period, that is Count of all ones and total number of employees in the organization during that period, that is Sum of count of all ones and zeros. In other words, turnover rate is the mean of turnover variable in your dataset. First let's look at the number of actives and inactive employees using the count function from the dplyr. Count function gives you the number of rows for each unique value in a specified column. You can calculate the turnover rate using the summarize function. As mentioned before, you can take the mean of the turnover column to accomplish this. Here you can see that approx. 18% of the employees are inactive, which means 82% of the employees are active in the dataset. Turnover adversely affects efficiency, productivity, profitability and morale of the organization. To retain the talent, it becomes imperative to find out where we are losing the most talent. Employee turnover rate can vary across job levels. Hence to calculate the level wise turnover rate you can use the group Y function. Visualizing your data generally helps when you're comparing several values. You can plot a bar graph of the level wise turnover rate using the geomcol layer and by placing the level on the X axis, turnover level on the Y axis. As you can see here, turnover rate is highest at the analyst and specialist levels. Now it's your turn to accept.
More from Richie

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon







