Suppose I have this series of numbers in a vector:
vec <- c(1,2,3,4,5) # just an example, numbers could be far higher
How can I programmatically divide these numbers into equally-spaced intervals ranging between 0-1
, such that I get:
for
- 1:
0
- 2:
0, 1
- 3:
0, 0.5, 1
- 4:
0, 0.33, 0.66, 1
- 5:
0, 0.25, 0.50, 0.75, 1
- and so on.
Any idea?