📅  最后修改于: 2022-03-11 14:56:10.448000             🧑  作者: Mango
df <- data.frame(id = rep(1:3, each = 5)
, hour = rep(1:5, 3)
, value = sample(1:15))
df %>% group_by(id) %>% mutate(csum = cumsum(value))