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

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

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.

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

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