Round half up in R.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|round.off <- function (x, digits=0)|
|posneg = sign(x)|
|z = trunc(abs(x) * 10 ^ (digits + 1)) / 10|
|z = floor(z * posneg + 0.5) / 10 ^ digits|