round.Rd
This is a custom round function that rounds a number to the nearest whole number down if the decimal is below 0.5 and up if it is above. Default R round behavior rounds decimals of 0.5 down when the whole number is even and this function avoids that behavior.
round(x, n)
x | the number or vector of numbers to round (numeric) |
---|---|
n | the number of decimal places to round (integer) |
returns a rounded version of the value provided
round(4.5, 0)#> [1] 5