library(readr)
library(ggplot2)
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.
Correlation 1: Satisfaction vs Last Evaluation
cor.test(hr$satisfaction_level, hr$last_evaluation)
##
## Pearson's product-moment correlation
##
## data: hr$satisfaction_level and hr$last_evaluation
## t = 12.933, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.08916727 0.12082195
## sample estimates:
## cor
## 0.1050212
Interpretation in technical terms
- p < 0.05 (2.2e-16), so the correlation is statistically
significant.
Interpretation in non-technical terms
- If employees report higher job satisfaction, their perfomrance
evaluations tend to be slightly higher too.
Scatterplot
ggplot(hr, aes(x = satisfaction_level, y = last_evaluation)) +
geom_point(alpha = 0.15, size = 1) +
geom_smooth(method = "lm", se = FALSE, color = "blue") +
labs(
title = "Higher Satisfaction is Slightly Linked to Higher Evaluations",
x = "Satisfaction Level",
y = "Last Evaluation Score"
)
## `geom_smooth()` using formula = 'y ~ x'

Correlation 2: Satisfaction vs Monthly Hours
cor.test(hr$satisfaction_level, hr$average_montly_hours)
##
## Pearson's product-moment correlation
##
## data: hr$satisfaction_level and hr$average_montly_hours
## t = -2.4556, df = 14997, p-value = 0.01408
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.036040356 -0.004045605
## sample estimates:
## cor
## -0.02004811
Interpretation in technical terms
- p < 0.05 (0.01408), so the correlation is statistically
significant.
Interpretation in non-technical terms
- Employees who work longer hours tend to report lower job
satisfaction.
Scatterplot
ggplot(hr, aes(x = average_montly_hours, y = satisfaction_level)) +
geom_point(alpha = 0.15, size = 1) +
geom_smooth(method = "lm", se = FALSE, color = "blue") +
labs(
title = "Employees Working Longer Hours Tend to Be Less Satisfied",
x = "Average Monthly Hours",
y = "Satisfaction Level"
)
## `geom_smooth()` using formula = 'y ~ x'

Correlation 3: Last Evaluation vs Average Monthly Hours
cor.test(hr$last_evaluation, hr$average_montly_hours)
##
## Pearson's product-moment correlation
##
## data: hr$last_evaluation and hr$average_montly_hours
## t = 44.237, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3255078 0.3538218
## sample estimates:
## cor
## 0.3397418
Interpretation in technical terms
- p < 0.05 (2.2e-16), so the correlation is statistically
significant.
Interpretation in non-technical terms
- Employees who are evaluated highly usually work more hours.
Scatterplot
ggplot(hr, aes(x = average_montly_hours, y = last_evaluation)) +
geom_point(alpha = 0.15, size = 1) +
geom_smooth(method = "lm", se = FALSE, color = "blue") +
labs(
title = "Higher Performance Scores Are Linked to More Work Hours",
x = "Average Monthly Hours",
y = "Last Evaluation Score"
)
## `geom_smooth()` using formula = 'y ~ x'

Correlation 4: Time at Company vs Number of Projects
cor.test(hr$time_spend_company, hr$number_project)
##
## Pearson's product-moment correlation
##
## data: hr$time_spend_company and hr$number_project
## t = 24.579, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1813532 0.2121217
## sample estimates:
## cor
## 0.1967859
Interpretation in technical terms
- p < 0.05 (2.2e-16), so the correlation is statistically
significant.
Interpretation in non-technical terms
- The longer someone stays at the company, the more projects they
have to work on.
Scatterplot
ggplot(hr, aes(x = time_spend_company, y = number_project)) +
geom_point(alpha = 0.4) +
geom_smooth(method = "lm", se = FALSE, color = "blue") +
labs(
title = "Employees Staying Longer Tend to Work on More Projects",
x = "Years at Company",
y = "Number of Projects"
)
## `geom_smooth()` using formula = 'y ~ x'
