I have a data set named pnc_1
It has the date column with several repeating dates and the wid column with numeric values. I am trying to add up all the wid values for each identical date and then put the results into a vector.
This loop freezes R-Studio.
cumsum <- 0
for (i in 1:(nrow(pnc_1)-1)) {
while (pnc_1$date[i] == pnc_1$date[i+1]) {
cumsum <- (pnc_1$wid[i] + pnc_1$wid[i+1])
}
}