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\(average_montly_hours,hr\)promotion_last_5years) # The correlation is not significant (p=value > .01) # Hours worked has no bearing on promotions
ggplot(hr, aes(x = average_montly_hours, y = promotion_last_5years)) +
geom_point() +
labs(title = "Scatter Plot: Average Hours vs. Promotion",
x = "Average Monthly Hours",
y = "Promotion")
#2 cor.test(hr\(time_spend_company,hr\)promotion_last_5years)
# The correlation is statistically signficant because the (p=value <
0.01) #The more time spent at the company is lead to a potential
promotion
ggplot(hr, aes(x = time_spend_company, y = promotion_last_5years)) +
geom_point() +
labs(title = "Scatter Plot: Time Spent at Company vs. Promotion",
x = "Time Spent at Company",
y = "Promotion")
ggplot(hr, aes(x = time_spend_company, y = promotion_last_5years)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "Scatter Plot: Time Spent at Company vs A promotion in the last 5 years",
x = " Time Spent",
y = "Promotion")
## `geom_smooth()` using formula = 'y ~ x'
#3 cor.test(hr\(satisfaction_level,hr\)last_evaluation) #
The correlation is statistically signifcant because the (p=value <
0.01) # as the last evaluation goes up then the satisfaction level also
goes up
ggplot(hr, aes(x = satisfaction_level, y = last_evaluation)) +
geom_point() +
labs(title = "Scatter Plot: Satisfaction vs. Evalulation",
x = "Satisfaction Level",
y = "Last Evalulation")
ggplot(hr, aes(x = satisfaction_level, y = last_evaluation)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "Scatter Plot: Satisfaction Level vs Evalulation",
x = " Satisfaction Level",
y = "Evalulation")
## `geom_smooth()` using formula = 'y ~ x'
#4 cor.test(hr\(last_evaluation,hr\)promotion_last_5years)
#The correlation isn’t statiscally signifcant (P=value >0.05) # the
last evulation has no signficance to the promotion in the last 5
years
ggplot(hr, aes(x = last_evaluation, y = promotion_last_5years)) +
geom_point() +
labs(title = "Scatter Plot: Last Evalulation vs A Promotion in the last 5 Years",
x = "Last Evalulation",
y = "Promotion in Last 5 years ")