plot_ly(hr, x = ~satisfaction_level, type = "histogram") %>%
layout(title = "Distribution Employee Satisfaction:
Most Employees Have Moderate Satisfaction",
xaxis = list(title = "Satisfaction Level"),
yaxis = list(title = "Count"))
Insight: The histogram shows that the majority of employees have moderate satisfaction levels, with fewer employees having very high or very low satisfaction.
plot_ly(hr, y = ~last_evaluation, type = "box") %>%
layout(title = "Box Plot of Last Evaluation Scores: Wide Range of Evaluation Performance",
yaxis = list(title = "Last Evaluation Score"))
Insight: The box plot shows a wide range of evaluation scores among employees, with most employees scoring between 0.6 and 0.85, indicating variable performance.
plot_ly(hr, x = ~Department, y = ~average_montly_hours, type = "box") %>%
layout(title = "Comparison of Monthly Hours by Department: R&D \n and Sales Have Higher Variability",
xaxis = list(title = "Department"),
yaxis = list(title = "Average Monthly Hours"))
Insight: Departments like R&D and Sales show greater variability in working hours compared to other departments, indicating that some employees work significantly more than others.
attrition_salary <- hr %>%
filter(left == 1) %>%
count(salary)
plot_ly(attrition_salary, labels = ~salary, values = ~n, type = 'pie') %>%
layout(title = "Attrition by Salary Level: High Attrition in Low Salary Group")
Insight: The pie chart reveals that most employees who left the company had a low salary, indicating a potential relationship between low salary and high turnover.
avg_satisfaction <- hr %>%
group_by(Department) %>%
summarise(avg_satisfaction = mean(satisfaction_level))
plot_ly(avg_satisfaction, x = ~Department, y = ~avg_satisfaction, type = 'bar') %>%
layout(title = "Average Satisfaction by Department: HR and \n Management Show Lower Satisfaction",
xaxis = list(title = "Department"),
yaxis = list(title = "Average Satisfaction Level"))
Insight: Employees in HR and Management departments show lower average satisfaction levels compared to other departments like R&D and Sales.