library(readr)
hr <- read_csv('https://raw.githubusercontent.com/aiplanethub/Datasets/refs/heads/master/HR_comma_sep.csv')
## Rows: 14999 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Department, salary
## dbl (8): satisfaction_level, last_evaluation, number_project, average_montly...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
##
## The following object is masked from 'package:ggplot2':
##
## last_plot
##
## The following object is masked from 'package:stats':
##
## filter
##
## The following object is masked from 'package:graphics':
##
## layout
# HISTOGRAM
plot_ly(hr, x = ~satisfaction_level, type = "histogram") %>%
layout(title = "Many Employees Have Low Satisfaction,<br> But Most Are Moderately Satisfied",
xaxis = list(title = "Satisfaction Level"),
yaxis = list(title = "Number of Employees"))
The bulk of the data is between .4 and .7
There is a strong number of employees with .1 level of satisfaction,
possibly employees that have left or been fired
#BOX
plot_ly(hr, x= ~last_evaluation, type = "box") %>%
layout(title = "Most Employees Score Between 0.6 and 0.9<br>in Their Last Performance Evaluation",
yaxis = list(title = "Last Evaluation Score"))
Most employees recieve high performance evals, most being betweeb .6
and .09
Most of the departments have very similar working hour ranges
Sales, Technical, and Support have the highest outliers
#PIE
plot_ly(
data = subset(hr, left == 1), # only employees who left
labels = ~salary,
type = "pie"
) %>%
layout(title = "Attrition Is Highest Among Low-Salary Employees")
Majority of the employees that left the company were from the low
salary group
high salary had very low percentage being that monetary
compensations keep employees
#BAR
hr %>%
group_by(Department) %>%
summarise(avg_satisfaction = mean(satisfaction_level)) %>%
plot_ly(x = ~Department, y = ~avg_satisfaction, type = "bar") %>%
layout(title = "Support & Technical Teams Have Lower Satisfaction Than Management Roles",
xaxis = list(title = "Department"),
yaxis = list(title = "Average Satisfaction Level"))
Accounting and HR have the lowest average satisfaction levels,
Marketing and R&D have the highest