I have a dataframe with
-time in seconds (integer)
-boolean value
I'm trying to aggregate the time to 60 sec intervals (0-59, 60-119, .... 11940-12000) to get the following dataframe:
-timeframe (n-th minute)
-number of elements of that timeframe
-number of elements of that timeframe where the boolean value was true
i looked into aggregate, sum, group_by and cut but don't understand how to solve my problem.
Thanks for everyone willing to help me!
EDIT:
output of dput(head(data, 20))
:
structure(list(time = c(5321L, 5320L, 5276L, 5275L, 5275L, 5269L, 5252L, 5195L, 5193L, 5190L, 5184L, 5177L, 5164L, 5146L, 5123L, 5118L, 5100L, 5085L, 5081L, 5062L), boolean = c(FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE)), row.names = 18:37, class = "data.frame")