R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

4B

titanic <- read.csv(paste("TitanicData.csv", sep=""))

table <- aggregate(titanic$Age ~ titanic$Survived, FUN = mean)
table
##   titanic$Survived titanic$Age
## 1                0    30.41530
## 2                1    28.42382

4C

t.test(titanic$Age~titanic$Survived)
## 
##  Welch Two Sample t-test
## 
## data:  titanic$Age by titanic$Survived
## t = 2.1816, df = 667.56, p-value = 0.02949
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.1990628 3.7838912
## sample estimates:
## mean in group 0 mean in group 1 
##        30.41530        28.42382

Null Hypothesis is Rejected.The Titanic survivors were younger than the passengers who died.