plot_ly(hr, x = ~satisfaction_level, type = "histogram") %>%
layout(title = "Most Employees have a Satisfaction Level between 0.5 and 1",
xaxis = list(title = "Employee Satisfaction Level"),
yaxis = list(title = "Count"))
plot_ly(hr, y = ~last_evaluation, type = "box") %>%
layout(title = "50% of Evaluation Scores fall between 0.56 and 0.87",
yaxis = list(title = "Last Evaluation Scores"))
plot_ly(hr, x = ~as.factor(Department), y = ~average_montly_hours, type = "box") %>%
layout(title = "There is about a Uniform Distribution Across the Departments",
xaxis = list(title = "Department"),
yaxis = list(title = "Average Monthly Hours"))
attrition_counts <- hr %>%
filter(left == "1") %>%
group_by(salary, left) %>%
count(left)
plot_ly(attrition_counts, labels = ~salary, values = ~n, type = 'pie') %>%
layout(title = 'As the Salary Increases, Less Employees Leave')
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 = 'Accounting has the Lowest Average Satisfaction Level of 0.58',
xaxis = list(title = 'Department'),
yaxis = list(title = 'Average Satisfaction Level'))