We can use cumsum
library(dplyr)
mydf%>%
mutate(runningTotal = cumsum(cost))
2
solved R – aggregating sum row wise [duplicate]
We can use cumsum
library(dplyr)
mydf%>%
mutate(runningTotal = cumsum(cost))
2
solved R – aggregating sum row wise [duplicate]