[Solved] Creating Index Variable in R [duplicate]


Do you just want to code the table up? Would something like this suffice?:

PCP <- c(0, 4.9, 5, 9.9, 10, 14.9, 15)
seq2max <- seq(0,max(PCP)+5,5)

result <- data.frame(min=seq2max,max=seq2max+4.9,DRI=seq_along(seq2max)-1)

  min  max DRI
1   0  4.9   0
2   5  9.9   1
3  10 14.9   2
4  15 19.9   3
5  20 24.9   4

result$DRI
# [1] 0 1 2 3 4

9

solved Creating Index Variable in R [duplicate]