I have some data with count value (which contain integer), date column and a identifiant column (containing 10 distinct values). I would like to know when the identifiant reaches a value in count value (like 100). For this reason, I would like to cummulate my count value for each identifiant (I don't know how to do this first part in R, I used Data.table) and after I will do a condition (when my commulate column is > 100, I will put 1 else 0) and a selection.
For the cummulate part, I don't know how to do according to column value.
#◘ Exemple of data
data <-data.frame(identifiant = c("A","A","A","A","A","B","B","B"),
date = as.Date(c("01/01/2018","02/01/2018","03/01/2018","04/01/2018","08/01/2018","03/01/2018","04/01/2018","08/01/2018"),format = '%d/%m/%Y'),
count = c(25,39,50,41,10,3,95,2))
# I would like a cummulate column like this
identifiant date count Cummulate
A 01/01/2018 25 25
A 02/01/2018 39 64
A 03/01/2018 50 114
A 04/01/2018 41 155
A 08/01/2018 10 165
B 03/01/2018 3 3
B 04/01/2018 95 98
B 08/01/2018 2 100
Thank you for advance