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

TASK 4b: Use R to create a table showing the average age of the survivors and the average age of the people who died.

Average age of survivors: 28.42

  aggregate(Titanic.df$Age, by=list(Titanic.df$Survived), mean)
##   Group.1        x
## 1       0 30.41530
## 2       1 28.42382

TASK 4c: Use R to run a t-test to test the following hypothesis:

H2: The Titanic survivors were younger than the passengers who died.

p-value = 0.02599 which is less than (<0.05) so we will reject the null hypothesis.

  library(MASS)
  library(psych)
  t.test(Titanic.df$Age ~ Titanic.df$Survived, var.equal=TRUE)
## 
##  Two Sample t-test
## 
## data:  Titanic.df$Age by Titanic.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