Analyzing employee engagement
1. Analyzing employee engagement
Has your workplace ever asked you to fill out an employee survey? If it included questions about how you feel about your job, the management, or your perception of your own future within the company, your responses may have been used to measure the level of employee engagement at your workplace.2. What is employee engagement?
Gallup, a performance-management consulting and research company, defines engaged employees as those who are involved in, enthusiastic about and committed to their work and workplace. This is usually measured with a survey, but behavioral data can be used as well.3. What is employee engagement?
The idea is that employees that are more engaged will be more productive and stay with the organization longer. There is some evidence to support this relationship, but since there isn't a single accepted definition of employee engagement, the connection between employee engagement and business outcomes is still debated. You, the data analyst, can investigate the link between engagement and business outcomes at your own company and decide how much to focus on employee engagement. In this course, you may assume that low employee engagement is something worth addressing.4. The survey data
For the upcoming exercises, you'll work with a set of engagement survey data that's already been joined with a few other employee data fields. Each employee has a single engagement score based on their responses to the survey. The score is a number from 1-5, where 5 is the most engaged, and 1 is the least engaged. This dataset includes employee-level data, meaning that each employee has an engagement score. In practice, you'll often be required to work with data that is aggregated at the manager or organization level. This provides an additional layer of anonymity for the employees, but also makes analysis harder.5. Review of mutate()
You will use two functions new to this course. The mutate() function, from the dplyr package, is similar to the summarize() function. The syntax is the same, but mutate() adds the new column to the existing dataset, retaining all the other columns. Here you can see the maximum salary is added to every row in the dataset.6. The ifelse() function
The other new function is ifelse(). ifelse() works much like the regular if/else statement in this example. x is 5, which is less than 10, so the statement returns the first value, "True". An if/else statement will fail if you have a vector of length greater than one, and you want to test every element of that vector, because if statements can only test objects of length one. ifelse() is the tool for testing vectors of length greater than one or entire columns from your dataset. It takes three arguments: a logical test, the return value if the test returns TRUE, and the value if the test returns FALSE.7. ifelse() + mutate()
Because ifelse() can test vectors, it can be used inside a mutate() call. Here, we create a new column, takes_vacation, which we want to be "Yes" if the number of vacation days taken is more than 10, and "No" otherwise. Creating new columns based on other columns is a powerful tool for HR analytics.8. Multiple summarizes
One more thing. You've already learned to do a group_by() and summarize() to get summary statistics for each of the groups you're analyzing. If you need to look at more than one summary statistic at once, you can do that with summarize() as well.9. Multiple summarizes
Just add a comma after the first variable assignment and function, and add another summary variable. Here, we've calculated the maximum, minimum, and average salary in one statement. You can do this for as many summary statistics as you need.10. Let's practice!
Now you can start analyzing the employee engagement data.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.