# Example 1
rain <- c(0,0.2,1.4,6.1,1.4,5.1,1.5,1.6,0.1,0,7,6,4,6,1.1,1.2,1.5,0)
cumrain(rain)
# should return this vector
# raincum <- c(0,0,1,2,3,4,5,6,6,6,6,6,6,6,6,6,7,7)
# Example 2
rain2 <- c(1,0,1,1,0,0,1,1,1,0,0,1,1)
cumrain(rain2)
# should return this
# raincum2 <- c(1,1,1,2,2,2,2,2,3,3,3,3,3)
Run the code above in your browser using DataLab