myRound | R Documentation |
The built-in R function round
rounds a 5 to the even digit. Instead, we preferred
the more intuitive rounding meaning that a 5 is always rounded to the next higher digit.
myRound(d)
d |
Real number. |
The biggest integer not bigger than d
if d - \lfloor d \rfloor < 0.5
and the smallest integer greater than
d
if d - \lfloor d \rfloor \ge 0.5
.
Kaspar Rufibach, kaspar.rufibach@gmail.com,
http://www.kasparrufibach.ch
Guenther Walther, gwalther@stanford.edu,
https://gwalther.su.domains/
The built-in R function round
.
x <- c(1.5, 2.5)
## built in R function
round(x)
## [1] 2 2
## this function
myRound(x)
## [1] 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.