title: R chisq.test test on data frame
body: <p>I am attempting to run a chi sqare analysis on the data frame (called "habitat.re") below however im having difficulty as I've gotten it to read the data but its giving the wrong results, when i prompt it with $expected it returns 18 different colums when there should be 3 (one for each site).</p>
  
  <p>All the tourorials ive been able to find have the data as a table, however i've not been able to convert it correctly myself.</p>
  
  <p><a href="https://i.stack.imgur.com/9bTWv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9bTWv.png" alt="data frame"></a>
  <a href="https://i.stack.imgur.com/xM5bx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xM5bx.png" alt="results"></a></p>