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.
1.
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
ggplot(hr, aes(x = satisfaction_level, y = average_montly_hours)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "Hours Worked Not Correlated To Satisfaction",
x = "Satisfaction Level",
y = "Average Monthly Hours")
## `geom_smooth()` using formula = 'y ~ x'

The p-value is greater than 0.01. The correlation between
satisfaction level and average monthly hours is not significant.
There is no correlation between satisfaction level and average
monthly hours.
There is no relationship between satisfaction level and average
monthly hours worked.
2.
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
ggplot(hr, aes(x = satisfaction_level, y = last_evaluation)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "More Satisfied Employees May Have Higher Evaluations",
x = "Satisfaction Level",
y = "Last Evaluation")
## `geom_smooth()` using formula = 'y ~ x'

The p-value is very small. The correlation between satisfaction
level and last evaluation is significant.
The correlation is positive and weak.
There is a weak positive relationship between satisfaction level and
last evaluation. Although the connection is small, employees who report
feeling more satisfied may also tend to have slightly higher
evaluations.
3.
cor.test(hr$average_montly_hours , hr$number_project)
##
## Pearson's product-moment correlation
##
## data: hr$average_montly_hours and hr$number_project
## t = 56.219, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.4039037 0.4303411
## sample estimates:
## cor
## 0.4172106
ggplot(hr, aes(x = average_montly_hours, y = number_project)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "More Projects Tend To Mean More Hours",
x = "Average Monthly Hours",
y = "Number Project")
## `geom_smooth()` using formula = 'y ~ x'

The p-value is very small. The correlation between average monthly
hours and number project is significant.
The correlation is positive and moderate.
There is a moderate positive relationship between average monthly
hours and number project. Employees who work on more projects tend to
spend more hours working each month.
4.
cor.test(hr$time_spend_company , hr$last_evaluation)
##
## Pearson's product-moment correlation
##
## data: hr$time_spend_company and hr$last_evaluation
## t = 16.256, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1158309 0.1472844
## sample estimates:
## cor
## 0.1315907
ggplot(hr, aes(x = time_spend_company, y = last_evaluation)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "More Time At Company Shows Slightly Higher Evaluations",
x = "Time Spent At Company",
y = "Last Evaluation")
## `geom_smooth()` using formula = 'y ~ x'

The p-value is very small. The correlation between time spend
company and last evaluation is significant.
The correlation is positive and weak.
There is a weak positive relationship between time spend company and
last evaluation. Employees who have been with the company longer tend to
receive slightly higher evaluations.