Read & view

dean.df=read.csv(paste("Data - Deans Dilemma.csv",sep=""))
View(dean.df)

Creating new dataframe placed

placed.df=dean.df[which(dean.df$Placement_B==1),]

create a table showing the mean salary of males and females, who were placed

aggregate(placed.df$Salary, by=list(placed.df$Gender), FUN=mean)
##   Group.1        x
## 1       F 253068.0
## 2       M 284241.9

Mean Salary of placed male MBA students

table2=by(placed.df$Salary,placed.df$Gender,mean)
table2[2]
##        M 
## 284241.9

Mean Salary of placed female MBA students

table2=by(placed.df$Salary,placed.df$Gender,mean)
table2[1]
##      F 
## 253068

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

t.test(Salary~Gender, data=placed.df)
## 
##  Welch Two Sample t-test
## 
## data:  Salary by 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

Since the p-value is less than 0.05, therefore we can reject the null hypothesis that there is no difference in the mean salary of male and female MBAs placed. This means that there is a significant difference between the average salary of the two groups.