I have the following code:
supply_agg = vector(length = 64, mode = 'list')
for (i in 1:64) {
supply_agg[[i]] <- PST[rownames(pct_kritiek),]*pct_kritiek[,i] *1000000
supply_agg[[i]] <- cbind("gg_omschrijving" = rownames(supply_agg[[i]]), supply_agg[[i]])
supply_agg[[i]] <- inner_join(koppelGG, supply_agg[[i]], by= "gg_omschrijving")
supply_agg[[i]] <- supply_agg[[i]][,-1]
supply_agg[[i]] <- supply_agg[[i]] %>%
group_by(gg_mm) %>%
summarise_each(funs(sum))
colnames(supply_agg[[i]]) <- koppelRK[1,]
supply_agg[[i]]<- pivot_longer(supply_agg[[i]], col= "Landbouw, bosbouw en visserij":"Milieu",names_to = "Regkol", values_to = "value")
supply_agg[[i]]<- supply_agg[[i]][,-3]
supply_agg[[i]] <- supply_agg %>%
group_by(gg_mm, Regkol) %>%
summarise_each(funs(sum()))
All goes well untill the last group_by(gg_mm, Regkol) I het this error:
"no applicable method for 'group_by_' applied to an object of class "list".
In the image you can see how the data looks just before the group_by function. I need to group when "gg_mm" and "Regkol" are the same.