Deans_Dilemma <- read.csv("C:/Program Files/RStudio/files/Data - Deans Dilemma.csv")
View(Deans_Dilemma)

1.Mean salary of males and females, who were placed.

placed <- Deans_Dilemma[ which(Deans_Dilemma$Placement_B==1), ]
x <- by(placed$Salary, list(placed$Gender), mean)
x
## : F
## [1] 253068
## -------------------------------------------------------- 
## : M
## [1] 284241.9

2.Salary of male MBAs who were placed

x <- by(placed$Salary, list(placed$Gender), mean)
x[2]
##        M 
## 284241.9

3.Salary of female MBAs who were placed

x <- by(placed$Salary, list(placed$Gender), mean)
x[1]
##      F 
## 253068

4.t-test for the Hypothesis “The average salary of the male MBAs is higher than the average salary of female MBAs.”

t.test(placed$Salary ~ placed$Gender)
## 
##  Welch Two Sample t-test
## 
## data:  placed$Salary by placed$Gender
## t = -3.0757, df = 243.03, p-value = 0.00234
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -51138.42 -11209.22
## sample estimates:
## mean in group F mean in group M 
##        253068.0        284241.9
  1. p-value = 0.00234

  2. As p-value<0.5, so there is no significant difference between the mean salaries of males and females, and the null hypothesis is not rejected.