Task 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 = "About 50% of Employees Are Satisfied (Satisfaction > 0.7)",
         xaxis = list(title = "Satisfaction Level"),
         yaxis = list(title = "Count of Employees"))

Analysis.

About 900 people are extremely unsatisfied. Also the fairly satisfied people and satisfied people have a fairly uniform distribution.

Task 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 = "A Majority of Last Evaluation Scores Fall Between 0.56 and 0.87",
         yaxis = list(title = "Last Evaluation Scores"))

Analysis.

There are no outlying scores which would appear outside of the range. The distribution of scores are fairly symmetrical.

Task 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 = ~Department, y = ~average_montly_hours, type = "box") %>%
  layout(title = "Management Has the Highest Monthly Hours, with 204, Compared to Other Departments",
         xaxis = list(title = "Department"),
         yaxis = list(title = "Average Monthly Hours"))

Analysis.

No department exceeds a maximum of 310 hours. Also no department has a minimum less then 96 hours.

Task 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.

salary_counts <- hr %>% count(salary)
plot_ly(salary_counts, labels = ~salary, values = ~n, type = 'pie') %>%
  layout(title = 'Low Salaried Employees Make Up 48.8% of the Companies Salaries')

Analysis.

The higher percentage of low incomes could correlate with high attrition rates. The large amount of low salaried employees shows the nature of jobs available in this company.

Task 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_level <- hr %>% group_by(Department) %>% summarise(avg_satisfaction_level = mean(satisfaction_level))
plot_ly(avg_satisfaction_level, x = ~factor(Department), y = ~avg_satisfaction_level, type = 'bar') %>%
  layout(title = 'The Accounting Department Has The Lowest Average Satisfaction Level',
         xaxis = list(title = 'Department'),
         yaxis = list(title = 'Average Satisfaction Level'))

Analysis.

Employees in the accounting department may have a greater risk of leaving which means their employee turnover may be high.