1. Histogram: Distribution of Employee Satisfaction Create a
histogram of the satisfaction_level variable. The title should reflect a
key takeaway from the distribution.
Histogram: Distribution of Employee Satisfaction Create a
histogram
of the satisfaction_level variable. The title should reflect a
key
takeaway from the distribution.
plot_ly(hr, x = ~satisfaction_level, type = "histogram") %>%
layout(title = "Most employees are satisfied (satisfaction > .5) ",
xaxis = list(title = "Satisfaction Level"),
yaxis = list(title = "Frequency"))
- Most employees are satisfied (satisfaction > .5)
- About 6% of employees are extremely dissatisfied (satisfaction <=
.1)
2. Box Plot: Last Evaluation Scores Create a box plot of the
last_evaluation variable. The title should highlight an important
insight about the evaluation scores.
plot_ly(hr, y = ~last_evaluation, type = "box") %>%
layout(title = "Most Employees Have Moderate to High Evaluation",
yaxis = list(title = "Last Evaluation"))
- Most employees have high evaluations (evaluation > .6)
- Around 25% of employees have very high evaluations (evaluation >
0.8).
- About 25% of employees have evaluations below 0.6, which could
indicate lower performance.
3. Comparative Box Plot: Monthly Hours by Department Create a
comparative box plot of average_montly_hours grouped by department. The
title should emphasize a significant difference or pattern among
departments.
- R&D Department has the widest range of average monthly hours,
with a range of approximately 120 hours.
- R&D has an IQR of about 50 hours, indicating high variability,
while Sales has a narrower IQR of around 30 hours.
- Median monthly hours vary by department, with R&D around 180
hours and Sales at 160 hours.
4. Pie Chart of Frequencies: Attrition by Salary Level Create a pie
chart showing the frequency of employee attrition (left) for each salary
category. The title should point out the relationship between salary and
attrition.
attrition_salary <- hr %>%
filter(left == 1) %>%
count(salary)
plot_ly(attrition_salary, labels = ~salary, values = ~n, type = 'pie') %>%
layout(title = 'Higher Attrition at Lower Salary Levels')
- People with lower salaries have the highest attrition rate
accounting for 60.*% of total attrition cases
- The data shows a strong link between lower salaries and higher
attrition rates, highlighting salary as a key factor in employee
retention.
5. Bar Plot of Averages: Average Satisfaction by Department Create a
bar plot displaying the average satisfaction_level for each department.
The title should highlight a key observation about departmental
satisfaction.
avg_satisfaction <- hr %>%
group_by(Department) %>%
summarise(avg_satisfaction_level = mean(satisfaction_level))
plot_ly(avg_satisfaction, x = ~factor(Department), y = ~avg_satisfaction_level, type = 'bar') %>%
layout(title = 'Satisfaction Level is highest in the Management Department',
xaxis = list(title = 'Department'),
yaxis = list(title = 'Average Satisfaction Level'))
- There are significant differences in average satisfaction levels
across departments, suggesting varying workplace satisfaction
experiences.
- The “Management” department has the highest average satisfaction
level at 0.62, indicating strong employee contentment.
- The “Sales” department shows the lowest average satisfaction level
at approximately 0.57, suggesting areas for improvement.