1. Histogram:Employee Satisfaction
plot_ly(hr, x = ~satisfaction_level, type = "histogram") %>%
layout(
title = "Most employees have moderate satisfaction (0.4–0.7)",
xaxis = list(title = "Satisfaction Level"),
yaxis = list(title = "Count")
)
Most employess report moderate satisfaction.
2. Box Plot: Last Evalution
plot_ly(hr, y = ~last_evaluation, type = "box") %>%
layout(
title = "Evaluation scores cluster between 0.6–0.9",
yaxis = list(title = "Last Evaluation Score")
)
Most employees are rated fairly consistently.
3. Comparative Box Plot: Monthly Hours by Department
plot_ly(hr, x = ~Department, y = ~average_montly_hours, type = "box") %>%
layout(
title = "Technical, IT, and Management departments work longer hours",
xaxis = list(title = "Department"),
yaxis = list(title = "Average Monthly Hours")
)
Technical, IT, and Management departments work longer hours over
average.
4. Pie Chart: Attrition by Salary
attrition_salary <- hr %>%
group_by(salary) %>%
summarize(attrition_count = sum(left), .groups = "drop")
plot_ly(attrition_salary, labels = ~salary, values = ~attrition_count, type = "pie") %>%
layout(title = "Low-salary employees have the highest attrition")
Employees with low salary have the highest turnover.
5. Bar Plot: Average Satisfaction by Department
dept_satisfaction <- hr %>%
group_by(Department) %>%
summarize(avg_satisfaction = mean(satisfaction_level))
plot_ly(dept_satisfaction, x = ~Department, y = ~avg_satisfaction, type = "bar") %>%
layout(
title = "Customer Service and Technical departments show the lowest average satisfaction",
xaxis = list(title = "Department"),
yaxis = list(title = "Average Satisfaction Level")
)
Customer Service and Technical departments have the lowest
satisfaction scores.