I have a percentage vector, for example,
v<- c(32.5 , 43.2 , 24.1)
> round(v)
[1] 32 43 24
> sum(round(v))
[1] 99
I want a function that handles my rounding so that it gets 100. In other words, I want a function fun
so that sum(fun(v))=100
.
The criterion, of course, must be so that each coordinate of fun(v)
gets as far from the original values as possible. Does anyone know of any method to do this?