titanicdat.df <- read.csv(paste("Titanic Data.csv",sep=" "))
View(titanicdat.df)
mytable <-aggregate(titanicdat.df$Age,by=list(survived=titanicdat.df$Survived),FUN=mean)
mytable
## survived x
## 1 0 30.41530
## 2 1 28.42382
average age of survivors=28 average age of casualties=30
t.test(mytable,var.equal = TRUE)
##
## One Sample t-test
##
## data: mytable
## t = 1.7893, df = 3, p-value = 0.1715
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## -11.64783 41.56739
## sample estimates:
## mean of x
## 14.95978
The p-value is higher than 0.05,This assumption is thus true.