dean.df <- read.csv(paste("Data - Deans Dilemma.csv", sep = ""))
View(dean.df)
mytable <- aggregate(Salary~Gender, data= dean.df, mean)
mytable
## Gender Salary
## 1 F 193288.2
## 2 M 231484.8
# Average Salary of males and females: 231484.8, 193288.2
library(MASS)
attach(dean.df)
t.test(Salary~Gender, data= dean.df)
##
## Welch Two Sample t-test
##
## data: Salary by Gender
## t = -2.69, df = 278.55, p-value = 0.007577
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -66149.06 -10244.26
## sample estimates:
## mean in group F mean in group M
## 193288.2 231484.8
### SInce P<0.05, we reject the null hypothesis and conclude that there is a statistical difference between the average salaries of the male to the female.