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:
Tree.ID, Species, Values, Year, Month
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.
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.
for(sp in unique(flower.B$Species)){
dat.sp <- flower.B[flower.B$Species == sp,]
Any thoughts on this?