title: Run chi-squared test on a data.frame
body: <p>I have this data.frame:</p>
  
  <pre><code>df &lt;- data.frame(xy = c("x", "y"), V1  = c(3, 0), V2 = c(0, 0), V3 = c(5, 0), V4 = c(5, 2))
  df 
    xy V1 V2 V3 V4
  1  x  3  0  5  5
  2  y  0  0  0  2
  </code></pre>
  
  <p>I want to know if <code>x</code> or <code>y</code> is more associated with any of <code>V1</code>, <code>V2</code>, <code>V3</code> or <code>V4</code>. To test this, I can use a chi-squared.</p>
  
  <p>This is what I've tried, none of which work:</p>
  
  <pre><code>chisq.test(df)
  chisq.test(as.matrix(df))
  chisq.test(as.table(df))
  </code></pre>
  
  <p>How can I run a chi-squared test on <code>df</code>?</p>