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"))
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"))
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"))
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%)')
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'))