I'm doing an analysis in which I need to identify the number of land uses (mapbiomas, codes 1, 9, 15, 21...) according to the IDs of my plots. However, I can't think of a way to accomplish this.
I was hoping to find a way in which, based on the plot IDs, I could access the sum of the "areaHA" values within each "mapbbiomas" code, something like this:
would you have any suggestions?
I tried grouping by ID and summarizing based on the sum of the areaHA values that had mapbiomas code 1:
%>% group_by(ID) %>% summarise(sum(a.col.df$areaHa[a.col.df$mapbiomas=='1']))
however it returns me for all ID the same values