as_result: Results with Rounding
Description
Rounds x according to digits, FUN and sets a tolerance for the result.
If the tolerance is not stated, consider it the maximum of 2*10^(-digits).
Usage
as_result(x, digits, tol = NA, FUN = round2)tol(x)
rounded(x)
val(x)
digits(x)
as_res(x, digits, tol = NA, FUN = round2)
tolerance(x)
Value
A list with the original and a rounded value, digits used and tolerance.
Arguments
- x
numeric: value to round
- digits
integer or character: Digits that should be used for rounding or "integer" for digits=0, "%" for digits=2, or "probability" for digits=4. Abbreviations for the names can be used
- tol
numeric: tolerance for result
- FUN
function: rounding function (default: round2)
Examples
Run this codex <- as_result(1/3, "prob")
tol(x)
rounded(x)
tol(x)
digits(x)
Run the code above in your browser using DataLab