1 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 = "Number of Employees"))

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 = "50% of Employees are Performing Relatively Well \n , In Between .56 and .87, \n Given Their Last Evaluation",
         yaxis = list(title = "Last Evaluation Score"))

The typical employee is scoring at a satisfactory level, meaning that the median last evaluation score is .72.

50% of employees are performing relatively well, in between .56 and .87, given their last evaluation score.

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.

plot_ly(hr, x = ~as.factor(Department), y = ~average_montly_hours, type = "box") %>%
  layout(title = "Across All Departments the Majority of Employees \n (the employyes within the IQR) \n Work Somewhere in Between 152 and 248 Average Monthly Hours",
         xaxis = list(title = "Department"),
         yaxis = list(title = "Average Monthly Hours"))

Across all departments, the majority of employees (the Middle 50% IQR) work somewhere in between 152 and 248 average monthly hours.

Management appears to have the least amount of variability in the average monthly hours worked (given that its IQR has the smallest range of only 82: 243-161 = 82).

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, 
        values = ~n, 
        labels = ~salary ,
        type = 'pie') %>%
  layout(title = 'Low Salary Employees Are More Likely to Leave \n than Middle or High Salary Employees')

Low salary employees are more likely to leave than middle or high salary employees

High salary employees are the least likely to leave in comparison to low and middle salary employees.

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 = mean(satisfaction_level, na.rm = TRUE)) 
plot_ly(avg_satisfaction, x = ~factor(Department), y = ~avg_satisfaction, type = 'bar') %>% 
  layout(title = 'The Department Does Not Seem to Impact \n Average Satisfaction Level for Employees',
         xaxis = list(title = 'Department'),
         yaxis = list(title = 'Average Satisfaction Level'))

The department does not seem to impact average satisfaction level for employees.

The management department has the highest average satisfaction level at .06213492 and accounting has the lowest at .05821512.