1 Histogram:Create a histogram of the satisfaction_level variable.

plot_ly(hr, x = ~satisfaction_level, type = "histogram") %>%
  layout(title = "About 50% of employees are satisfied (>.7) ",
         xaxis = list(title = "Satisfaction Level"),
         yaxis = list(title = "Count of Employees"))

2 Box Plot: Last Evaluation Scores

plot_ly(hr, x = ~last_evaluation, type = "box") %>%
  layout(title = "Majority of scores fall between .56 and .87  ",
         xaxis = list(title = "Last Evaluation"),
         yaxis = list(title = "Count of employees"))

3 Comparative Box Plot: Monthly Hours by Department

plot_ly(hr, x = ~Department, y = ~average_montly_hours, type = "box") %>%
  layout(title = "Management has highest hours per month",
         xaxis = list(title = "Department"),
         yaxis = list(title = "average monthly hours"))

4 Pie Chart of Frequencies: Attrition by Salary Level

cyl_counts <- hr %>% count(salary)
plot_ly(cyl_counts, labels = ~salary, values = ~n, type = 'pie') %>%
  layout(title = 'The Majority of salary level is low')

5 Bar Plot of Averages: Average Satisfaction by Department

dep_mean <- hr %>% 
  group_by(Department) %>% 
  summarise(satisfaction_level = mean(satisfaction_level))

plot_ly(dep_mean, 
        x = ~factor(Department), 
        y = ~satisfaction_level, 
        type = 'bar') %>%
  layout(title = 'Average Satisfaction Level by Department: IT Leads in Employee Satisfaction',
         xaxis = list(title = 'Department'),
         yaxis = list(title = 'Average Satisfaction Level'))