I have a data frame with a column labeled "occasion" which ranges from 1 to 21. I would like to subset on any sequence within that range (say: 5 to 19), but then re-sequence the occasion from 5 to 19 to 1 to 15. I know how to subset. It's part 2 I'm stuck on. The only way I know how to do this is:
df$occasion[df$occasion == 5] <- 1 df$occasion[df$occasion == 6] <- 2 . . df$occasion[df$occasion == 19] <- 15
Is there a function or index method I can use to simplify this procedure by passing the interval (i.e., 5, 19)? Thanks in advance. NARP (Not an R programmer)