Here is my file:
time3
is going from around -3600 to +400-600ms. I need to bin this time3
in 20 seconds window with the 0
time point staying as 0
and not being in the middle of a window. Then I need to do a mean of reSYS
for each 20 sec windows.
I need to do this for each Subject
("DL001"
to "DL028"
) and each condition
("Light"
or "control"
).
I tried several options, the closer one is this one:
data3 <- data2 %>%
group_by(time3 = cut(time3, breaks=205, include.lowest = TRUE)) %>%
summarize(RR_int.mean = mean(RR_int))
But the 20 sec window start with the first time point that appears -3599.312
and goes all the way up, such that the 0
time point is in a window between -9
and +11
. It average all the values from all the subjects together as well instead of doing it for each subject separately.
Can someone help me?