### TITANIC CASE STUDY###
 #UNDER THE GUIDANCE OF PROF. SAMEER MATHUR(Ph.D) IIM-LUCKNOW
 

1) reading data of csv into working directory

titanic.df <- read.csv(print(“Titanic Data.csv”, sep=“”))

2) for viewing the file

View(titanic.df)

nrow(titanic.df)

3) To find the number of passengers who survived from the sinking of the titanic

table(titanic.df$Survived)

4)measure the % of passengers who survived the sinking of the titanic

datatable <- with(titanic.df,table(Survived)) prop.table(datatable)*100

5)To count the no of 1st class passengers who survived the from the sinking of the titanic

datatable <- xtabs(~Survived +Pclass,data = titanic.df) datatable

6)To find the % of 1st class passengers who survived the sinking of the titanic

prop.table(datatable,2)*100

7)To count the no of 1st class females who survived the sinking of the titanic

datatable <- xtabs(~Survived + Pclass + Sex, data = titanic.df) datatable

8)To measure the % of survivors who were female

datatable <- xtabs(~Survived+Sex, data = titanic.df) prop.table(datatable,2)*100

9)To measure the % of female survivors survived onboard

datatable <- xtabs(~Survived+Sex, data = titanic.df) prop.table(datatable,1)*100

10)chi-square test

summary(datatable)

chisq.test(datatable)

chisq.test(prop.table(datatable))