Let's say I have a vector of numbers specifying lengths.
x = c(3,5,4,10)
Then I run cumsum to get their ranges.
cumsum(x)
3 8 12 22
How would I pair each up to produce pairs of ranges, starting with 1.
Preferable as a character vector:
c("1-3", "3-8", "8-12", "12-22")
You could use
paste
like this: