TitanicData.df <- read.csv(paste("Titanic Data.csv"), sep = ",")
View(TitanicData.df)

Task 4a. Recalled.

Task 4b. A table showing the average age of the survivors and the average age of the people who died

aggregate(TitanicData.df$Age~TitanicData.df$Survived, FUN= mean )
##   TitanicData.df$Survived TitanicData.df$Age
## 1                       0           30.41530
## 2                       1           28.42382

Average AAge of the survived = 28.42

Task 4c. T-test to test the following hypothesis: The Titanic survivors were younger than the passengers who died.

t.test(TitanicData.df$Age~TitanicData.df$Survived, var.equal= TRUE)
## 
##  Two Sample t-test
## 
## data:  TitanicData.df$Age by TitanicData.df$Survived
## t = 2.2302, df = 887, p-value = 0.02599
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.238890 3.744064
## sample estimates:
## mean in group 0 mean in group 1 
##        30.41530        28.42382

Analysis of the t-test: 1.The difference between the two samples is relatively high for comparision. p- value= 0.02 < 0.05. 2.The avergar age of the survived group is lesser than that of the not survived group.