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:

4a

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

4b

by(Titanic.df$Age, Titanic.df$Survived , mean)
## Titanic.df$Survived: 0
## [1] 30.4153
## -------------------------------------------------------- 
## Titanic.df$Survived: 1
## [1] 28.42382

4c

H2: titanic saviors were younger than passengers who died

t.test(Titanic.df$Survived, Titanic.df$Age, paired = TRUE)
## 
##  Paired t-test
## 
## data:  Titanic.df$Survived and Titanic.df$Age
## t = -67.065, df = 888, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -30.12782 -28.41458
## sample estimates:
## mean of the differences 
##                -29.2712

p-value< 2.2e-16

The average age of people who Died is greater than average of people who Survived.