I have a data set that contains the time in which participants monitored a clock during an experiment. How can I calculate the total number of times the CheckTime variable exists for each participant? Or to put it another way, How do I know how many times each participant looked at the clock?
I tried:
group_by(Participant, CheckTime) %>%
summarize(count = n())
But this way I get the number of times each specific time appears in the data set and not the sum of all clockchecks by individual.
This is part of my data:
tibble::tribble(
~Participant, ~CheckTime, ~Valence, ~n,
1L, 16, 0, 1L,
1L, 18, 0, 1L,
1L, 19, 0, 1L,
1L, 21, 0, 2L,
1L, 23, 0, 1L,
1L, 26, 0, 2L,
1L, 28, 0, 1L,
1L, 30, 0, 2L,
1L, 31, 0, 1L,
1L, 34, 0, 1L,
1L, 35, 0, 2L,
1L, 36, 0, 2L,
1L, 37, 0, 2L,
1L, 39, 0, 1L,
1L, 41, 0, 2L,
1L, 44, 0, 1L,
1L, 47, 0, 1L,
1L, 49, 0, 1L,
1L, 50, 0, 1L,
1L, 52, 0, 2L,
1L, 54, 0, 1L,
1L, 57, 0, 2L,
1L, 58, 0, 2L,
1L, 59, 0, 3L,
1L, 60, 0, 3L,
1L, 61, 0, 3L,
1L, 65, 0, 1L,
1L, 82, 0, 1L,
2L, 0, 1, 1L,
2L, 1, 1, 10L,
2L, 2, 1, 3L,
2L, 7, 1, 1L,
2L, 8, 1, 2L,
2L, 9, 1, 3L,
2L, 10, 1, 1L,
2L, 11, 1, 1L,
2L, 13, 1, 3L,
2L, 17, 1, 2L,
2L, 19, 1, 2L,
2L, 20, 1, 1L,
2L, 21, 1, 1L,
2L, 22, 1, 1L,
2L, 23, 1, 3L,
2L, 24, 1, 2L,
2L, 27, 1, 6L,
2L, 30, 1, 1L,
2L, 32, 1, 1L,
2L, 33, 1, 4L,
2L, 36, 1, 1L,
2L, 37, 1, 1L,
2L, 39, 1, 1L,
2L, 41, 1, 3L,
2L, 42, 1, 2L,
2L, 43, 1, 2L,
2L, 44, 1, 1L,
2L, 45, 1, 4L,
2L, 46, 1, 2L,
2L, 47, 1, 2L,
2L, 49, 1, 3L,
2L, 50, 1, 4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