I would like to negatively select (all but the given row value for each level of a factor variable) and summarize the data that remains. For a simple example, I have a data frame, DF, with two columns.
>DF
Category Value
A 5
B 2
C 3
A 1
C 1
It would look something like this if dplyr could negative select (can it?).
> DF %>% group_by(!Category) %>% summarise(avg = mean(Value))
!Category avg
A 2.00 #average of all rows where category isn't A
B 2.50
C 2.67