Histogram: Distribution of Employee Satisfaction

Create a histogram of the satisfaction_level variable.

plot_ly(hr, x = ~satisfaction_level, type = "histogram") %>%
  layout(title = "Most Employees are Satisfied (Satisfaction > .5)",
         xaxis = list(title = "Satisfaction Level"),
         yaxis = list(title = "Employees"))
Analysis
  • The number of employees with satisfaction levels from 0.3 to 1.0 are close to even across the board (contains the majority of employees)
  • There is a large spike at the lowest satisfaction level (around 0.1 or below), indicating that a significant number of employees report very low satisfaction

Box Plot: Last Evaluation Scores

Create a box plot of the last_evaluation variable.

plot_ly(hr, y = ~last_evaluation, type = "box", name = "Last Evaluation Scores") %>%
  layout(title = "The majority of employees have moderate-to-good 
         evaluation scores (between 0.6 to 0.8)",
         yaxis = list(title = "Last Evaluation Scores"))
Analysis
  • Half of the employees received evaluation scores above 0.72, and half received scores below 0.72
  • The lowest and highest scores respectivly are 0.36 and 1.0
  • Most employees scored between 0.6 and 0.8

Comparative Box Plot: Monthly Hours by Department

Create a comparative box plot of average_montly_hours grouped by department.

plot_ly(hr, x = ~as.factor(Department), y = ~average_montly_hours, type = "box") %>%
  layout(title = "There is a relativly uniform workload across departments",
         xaxis = list(title = "Departments"),
         yaxis = list(title = "Monthly Hours"))
Analysis
  • Most departments have a median around 200 hours
  • The departments do not show large disparities in the working hours, relatively consistent across departments
  • Most of the monthly hours per department fall in a narrow range between 150 and 250 hours

Pie Chart of Frequencies: Attrition by Salary Level

Create a pie chart showing the frequency of employee attrition (left) for each salary category.

attrition_counts <- hr %>% 
  group_by(salary) %>% 
  count(left) %>% 
  filter(left == 1)

plot_ly(attrition_counts, labels = ~salary, values = ~n, type = 'pie',
        marker = list(colors = c('#636EFA', '#EF553B', '#00CC96'))) %>%
  layout(title = 'High proportion of employee attrition for low salary employees (above 50%)')
Analysis
  • There is a significantly low proportion of employee attrition for high salary employees (only 2.3% of employees)
  • Over half (60.8%) of the employees with low salaries left their jobs
  • Employees with higher salaries have lower attrition rates

Bar Plot of Averages: Average Satisfaction by Department

Create a bar plot displaying the average satisfaction_level for each department.

avg_satisfaction <- hr %>% 
  group_by(Department) %>% 
  summarise(avg_satisfaction = mean(satisfaction_level))

plot_ly(avg_satisfaction, x = ~factor(Department), y = ~avg_satisfaction, type = 'bar') %>%
  layout(title = 'Consistent level of moderate employee satisfaction across departments',
         xaxis = list(title = 'Departments'),
         yaxis = list(title = 'Average Satisfaction Level'))
Analysis
  • The Accounting department has a slightly lower satisfaction level compared to other departments
  • Most of the departments have an employee satisfaction level around 0.6
  • Satisfaction level across departments is relatively consistent