as_result {exams.forge}R Documentation

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)

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)

Value

A list with the original and a rounded value, digits used and tolerance.

Examples

x <- as_result(1/3, "prob")
tol(x)
rounded(x)
tol(x)
digits(x)

[Package exams.forge version 1.0.10 Index]