Skip to contents

Distributes an integer total (`tot`) across the elements of a numeric vector (`v`). by alternating ceiling and floor operations to prevent rounding bias, while ensuring that the returned vector sums exactly to `tot`.

Usage

smooth.div(tot, v)

Arguments

tot

Numeric/Integer. The target sum total to distribute.

v

Numeric vector containing fractional values or proportion targets.

Value

A numeric vector of the same length as `v` containing integer values that sum to `tot`.