myRound: Round 5 up to the next higher integer

Description Usage Arguments Value Author(s) See Also Examples

View source: R/myRound.r

Description

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.

Usage

1

Arguments

d

Real number.

Value

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 ≥ 0.5.

Author(s)

Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch

Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther

See Also

The built-in R function round.

Examples

1
2
3
4
5
6
7
8
9
x <- c(1.5, 2.5)

## built in R function
round(x)
## [1] 2 2

## this function
myRound(x)
## [1] 2 3

modehunt documentation built on May 29, 2017, 5:02 p.m.