View source: R/archive/num_result.R
| num_result | R Documentation |
num_result creates a list with the elements
num_result(x, digits = NULL, tolerance = NULL, tolmult = 2, ...)
int_result(x, ...)
x |
numeric: rounded data |
digits |
numeric: number of digits to rounding (default: |
tolerance |
numeric: tolerance for rounded data (default: |
tolmult |
numeric: multiplier for tolerance |
... |
further parameters to |
x the original values
fx the rounded values with exams::fmt() as character
tolerance the tolerance
digits the digits used for rounding
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.
a list
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.