titanic.df <- read.csv(paste("C:/Users/kogentix/Downloads/Internship docs/week1/Titanic Data.csv", sep=""))
View(titanic.df)
summary(titanic.df)
## Survived Pclass Sex Age SibSp
## Min. :0.0000 Min. :1.000 female:312 Min. : 0.40 Min. :0.0000
## 1st Qu.:0.0000 1st Qu.:2.000 male :577 1st Qu.:22.00 1st Qu.:0.0000
## Median :0.0000 Median :3.000 Median :29.70 Median :0.0000
## Mean :0.3825 Mean :2.312 Mean :29.65 Mean :0.5242
## 3rd Qu.:1.0000 3rd Qu.:3.000 3rd Qu.:35.00 3rd Qu.:1.0000
## Max. :1.0000 Max. :3.000 Max. :80.00 Max. :8.0000
## Parch Fare Embarked
## Min. :0.0000 Min. : 0.000 C:168
## 1st Qu.:0.0000 1st Qu.: 7.896 Q: 77
## Median :0.0000 Median : 14.454 S:644
## Mean :0.3825 Mean : 32.097
## 3rd Qu.:0.0000 3rd Qu.: 31.000
## Max. :6.0000 Max. :512.329
aggregate(titanic.df$Age,list(Survivors=titanic.df$Survived),mean)
## Survivors x
##1 0 30.41530
##2 1 28.42382
t.test(Age~Survived,titanic.df)
## Welch Two Sample t-test
##
##data: Age by 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
```