title: 2 by 2 table (Class*Sex) using Titanic data from R package "titanic"
body: <p>I am working on R system data from the R package titanic <code>install.packages("titanic")</code>. The name of the dataset is <code>titanic</code>. </p>
  
  <p>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.</p>
  
  <p>Expected 2 by 2 table: letter represent number(frequency)</p>
  
  <pre><code>                         Sex
                      Male      Female
  
  Class     1st        a          b
            2nd        c          d
            3rd        e          f
            crew       g          h
  </code></pre>