reround() rounds a vector of reconstructed values the way
they are assumed to have been rounded originally. It is the common
interface to all of roundwork's rounding functions and to
base::round().
Arguments
- x
Numeric. Values to round.
- digits
Integer. Number of decimal places to round to, i.e., the number in the reported values. Length 1 or the length of
x. Must be whole numbers; a missing value propagates to a missing result.- rounding
String (length 1). The rounding method. Default is
"up_or_down", which returns two values per element ofx: rounded up and rounded down.- threshold
Numeric (length 1). For
"up_from","down_from", and"up_from_or_down_from", the point within a step at which rounding switches direction, in tenths of a step; greater than0and less than10. Default is5, which makes these methods the same as"up","down", and"up_or_down". Seeround_up_from().- symmetric
Logical (length 1). If
TRUE, negative numbers are rounded like their absolute values under"up","down","up_or_down", and the"*_from"methods. Default isFALSE. Must not beTRUEwith a"ties_*"method, which already fixes the direction:"ties_up"withsymmetric = TRUEwould be"ties_away", so write that instead.
Value
Numeric. One value per element of x, except for the compound
methods "up_or_down", "up_from_or_down_from", and "ceiling_or_floor",
which return two: the results of their two constituent procedures, next to
each other, as c(up_1, down_1, up_2, down_2, ...). Each pair belongs to
one element of x, so the pairs must not be pooled across elements.
Details
reround() calls the rounding function that rounding names. See
vignette("rounding-options") for the possible values, and round_up()
and round_ceiling() for the functions themselves.