num_result {exams.forge}R Documentation

Numeric Rounding List

Description

num_result creates a list with the following elements:

Note that x may contain more than one numeric value to determine the rounding and tolerance. Make sure that you use for numeric exercises ...$x[1].

If digits are not given and length(x)>1 then ceiling(-log10(min(diff(sort(x)), na.rm=TRUE))) is used. If digits are not given and length(x)==1 then 3+ceiling(-log10(abs(x))) is used. If no tolerance is given then tolmult*10^(1-digits) is used.

int_result can be used if the result is an integer number and calls num_result(x, 0, 0.1, 1, ...) with a tolerance of 0.1.

Usage

num_result(x, digits = NULL, tolerance = NULL, tolmult = 2, ...)

int_result(x, ...)

num_res(x, digits = NULL, tolerance = NULL, tolmult = 2, ...)

int_res(x, ...)

Arguments

x

numeric: rounded data

digits

numeric: number of digits of rounding (default: NULL)

tolerance

numeric: tolerance for rounded data (default: NULL)

tolmult

numeric: multiplier for tolerance

...

further parameters from exams::fmt()

Value

A list.

Examples

# height for german man (in meter)
x <- rnorm(10, mean=1.8, sd =0.25)
num_result(c(mean(x), x), digits=2)
int_result(mean(x))
#
str(num_result(pi, 3))
str(num_result(pi, 6))
str(num_result(pi, 6, tolmult=5))
str(num_result(pi, 6, tolmult=5, tolerance=1e-6))

[Package exams.forge version 1.0.10 Index]