Round.Rd
This is an ordinary rounding function, so called round half away from zero
Round(x, n = 0)
x | numeric to be rounded |
---|---|
n | indicating decimal digits |
The function round
in R base rounds to the even number, i.e. round(0.5)
is 0 not 1.
If you want rounding 0.5 be 1, you can use this Round
function.
This function is for the consistency with other software like MS-Excel, SAS.
ordinarily rounded value
See wikipedia subject "Rounding"
Kyun-Seop Bae <k@acr.kr>
(x = 1:10 - 0.5)#> [1] 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5Round(x)#> [1] 1 2 3 4 5 6 7 8 9 10#> [1] 0 2 2 4 4 6 6 8 8 10