I am trying to calculate the means of different columns, based on a criteria in R.
Now, I want to calculate the mean for every year and for every company.
I have tried this code, but it is not working:
DF %>% group_by("Year") %>% colMeans(DF, na.rm=TRUE)
Does anybody have an idea?