I am working on R system data from the R package titanic install.packages("titanic")
. The name of the dataset is titanic
.
I want to conduct a Chi-square test between Class and Sex. I think before doing Chi-square I need to come up with 2 by 2 table. How can I come up with a 2 by 2 table ? or how can I do Chi-square test considering the data structure.
Expected 2 by 2 table: letter represent number(frequency)
Sex
Male Female
Class 1st a b
2nd c d
3rd e f
crew g h