4(a)

titanic <- read.csv("~/Titanic Data.csv")
  View(titanic)

4(b)

titanic$Survived = factor(titanic$Survived, levels = c(0,1), labels = c("Not Survived","Survived"))
aggregate(Age ~ Survived, data= titanic,mean)
##       Survived      Age
## 1 Not Survived 30.41530
## 2     Survived 28.42382

4(c)

log.transformed.Age=log(titanic$Age)
 t.test(log.transformed.Age ~ titanic$Survived,var.equal=TRUE)
## 
##  Two Sample t-test
## 
## data:  log.transformed.Age by titanic$Survived
## t = 3.844, df = 887, p-value = 0.0001297
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.09102778 0.28094770
## sample estimates:
## mean in group Not Survived     mean in group Survived 
##                   3.304318                   3.118330