I'm wondering how to filter and summarise the following DF using a single line code into a new dataframe (DF1). In other words, how to filter different row ranges (separately) for each column nomenclature (group A and B) and returning the mean.for each sub group.
So far, thats what I have found:
DF1<-DF %>% Filter(between(VALUE, 1,3) %>% summarise(meanVALUE=mean(VALUE))
Nevertheless it will return the mean for the first sub group only (values 1,2,3). How to consider the remaining groups within the filter?
| GROUP | VALUE |
Any help is very appreciated.