An internal function not intended for the user. Given a number x and vector of
permitted values,
returns the closest permitted value to x (in absolute value).
Usage
closest(x, candidates)
Arguments
x
The number to be compared to the permitted values.