I need to rescale a series of numbers with certain constraints.
Let's say I have a vector like this:
x <- c(0.5, 0.3, 0.6, 0.4, 0.9, 0.1, 0.2, 0.3, 0.6)
- The sum of x must be 6. Right now the sum of x = 3.9.
- The numbers cannot be lower than 0
- The numbers cannot be higher than 1
I know how to do 1 and 2+3 separately, but not together. How do I rescale this?
EDIT: As was tried by r2evans, preferably the relative relationships of the numbers is preserved