I have this data frame.
Subjects include 1-5 with a count of 30 for each. Intervals 1-30 and X and Y coordinates for each interval and subject. I want to have the intervals binned into groups of 6 in order to get the means of X and Y per bin for each subject.
subset <- mydata %>% group_by(Subject) %>% summarise_at(vars(X:Y), mean, na.rm = TRUE)
When I do this, I get the overall means of X and Y for all intervals. How would I go about doing this correctly?