Setting directory

setwd("E:/Internship/Tasks/Week 2/Week 2, Day 1 (Mon)")

Datadrame Created

data.df <- read.csv(paste("Data - Deans Dilemma.csv", sep=""))

Dataframe of placed students creating

placed.df <-data.df[which(data.df$Placement_B=='1'),]

Task 3(d)

Question 1.) Creating table with average salary of males and female placed.

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

Question 2.) Female average salary is 253068.0

Question 3.) Male avaerage salary is 284241.9

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

Question 4.) R Code to run t-test " t.test(Salary~ Gender, data=placed.df) "

Question 5.) P-Value from above run test is 0.00234

Question 6.) Since P-value is less than 0.05 so there is significant differnce in means of salary of males and females and we accept the t-test also female mean salary is 253068.0 and male mean salary is 284241.9 so difference in their mean is 31173.9