round2_fmt | R Documentation |
These functions provide rounding and formatting similar to exams::round2
and exams::fmt
.
round2
performs half-up rounding with a small offset to avoid rounding errors.
fmt
formats numbers as character strings with a specified number of decimal places.
round2(x, digits = 0)
fmt(x, digits = 2L, zeros = digits < 4L, ...)
x |
Numeric vector to be rounded or formatted. |
digits |
Integer, number of decimal places. Default is 0 for |
zeros |
Logical, whether to keep trailing zeros. Default is TRUE if digits < 4 ( |
... |
Additional arguments passed to |
round2
returns a numeric vector rounded to the specified number of digits.
fmt
returns a character vector with numbers formatted as strings with the requested number of decimal places.
Adapted from exams
package by R. Schwabe et al.
round2
, fmt
from the exams
package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.