reround {scrutiny} | R Documentation |
General interface to reconstructing rounded numbers
Description
reround()
takes one or more intermediate reconstructed values
and rounds them in some specific way – namely, the way they are supposed
to have been rounded originally, in the process that generated the reported
values.
This function provides an interface to all of scrutiny's rounding functions
as well as base::round()
. It is used as a helper within grim()
,
grimmer()
, and debit()
; and it might find use in other places for
consistency testing or reconstruction of statistical analyses.
Usage
reround(
x,
digits = 0L,
rounding = "up_or_down",
threshold = 5,
symmetric = FALSE
)
Arguments
x |
Numeric. Vector of possibly original values. |
digits |
Integer. Number of decimal places in the reported key values
(i.e., mean or percentage within |
rounding |
String. The rounding method that is supposed to have been
used originally. See |
threshold |
Integer. If |
symmetric |
Logical. Set |
Details
reround()
internally calls the appropriate rounding function(s)
determined by the rounding
argument. See vignette("rounding-options")
for a complete list of values that rounding
can take.
For the specific rounding functions themselves, see documentation at
round_up()
, round_ceiling()
, and base::round()
.
Value
Numeric vector of length 1 or 2. (It has length 1 unless rounding
is "up_or_down"
, "up_from_or_down_from"
, or"ceiling_or_floor"
, in
which case it has length 2.)