I have a data frame, which contains two columns, Time and Response
df = cbind.data.frame(
Time = c(1, 1.2, 1.9, 2.2, 2.9, 3.1, 3.2, 3.2, 3.2, 3.6, 3.9, 4, 5.1, 5.99),
Response = c(1, 1, 1, 2, 3, 3, 3, 4, 3.5, 3.6, 3.3, 6, 11, 13)
)
I want to transform it by summing the Response within the same minute (Time) . [1-2), [2-3), [3-4), [4-5), and [5 and above].
The expected data frame will be
dfe = cbind.data.frame(
time.range = c(1, 2, 3, 4, 5),
Response = c(3, 5, 19.4, 6, 24)
)