title: How to convert rows in a data frame as unique with a for loop?
body: <p>I have the following type of data. A column with  tree Species (33 types), one with tree ID (for every species many trees were observed), a column with some values for each tree of each species, year, month: </p>
  
  <p>Tree.ID, Species, Values, Year, Month</p>
  
  <p>The data set is quite big > 20 000 rows. For my further analyses I need to first transform the Species column in the data frame as unique characters, as later I will need to run a for loop for every species and analyse their behaviour over many years.</p>
  
  <p>Here is the code I am using to turn the Species column in the data frame as unique characters. I am using the following code that is not working and returns only one species, instead of all 33 with all their values. </p>
  
  <pre><code>for(sp in unique(flower.B$Species)){
    dat.sp &lt;- flower.B[flower.B$Species == sp,]
  </code></pre>
  
  <p>Any thoughts on this? </p>