Description Usage Arguments Details Author(s) References See Also Examples
The round2
function rounds numbers in the
way you probably learned in school, that is, round up to
the next number for values of 5 and above.
1 | round2(x, digits = 0)
|
x |
The number (or vector of numbers) that needs rounding. |
digits |
The number of decimal places in the output. |
To reduce bias in rounding, R's round
function uses a "round-to-even" approach. Still, many
people are surprised when they find that R's round
function will return the same value for round(1.5)
and round(2.5)
. This function uses the rounding
approach found in most school lessons and in software
like Excel to make the results comparable.
Unknown (see "References")
Function originally found in an anonymous comment at the Statistically Significant blog. See http://www.webcitation.org/68djeLBtJ
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.