title: Joining two columns (1 factor, 1 integer) in R
body: <p>Below is the first 5 rows of my data: the data frame is called inverts</p>
  
  <pre><code>    Location Transect  Species         Count
      McAbee     M1       Bat Star         35
      McAbee     M1       Turban Snail     2
      McAbee     M1       Sun Star         1
      McAbee     M1       Chiton           1
      ..........
  </code></pre>
  
  <p>I am trying to join my species and count data together so I can perform an ANOVA to see the differences between location and transect. I have two locations and four transects total. </p>
  
  <p>I believe the <code>tapply()</code> function is the correct one to use to join <code>Species</code> and <code>Count</code> together but I can't figure out the code.</p>
  
  <p>I believe the code should be:</p>
  
  <pre><code>inverts$speciescount = tapply(inverts$Species, inverts$Count, ....)
  </code></pre>
  
  <p>So I have gotten some good feedback on how to combine the two columns, however, I am still unable to compare the data between transects and location. I am unsure on how to proceed.  What I want to do is create a code where it is:   </p>
  
  <pre><code>Count ~ Transect
  # or 
  Count ~ Location
  </code></pre>
  
  <p>The problem with just doing that is the Count data is just a bunch of numbers and it is referenced to a species. Does anyone have any suggestions?</p>
  
  <p>Thanks for helping</p>