Learn R Programming

rubias (version 0.3.4)

round2: Round a given number, with 5 always rounded up

Description

Given a number and a digit to round to, returns the rounded number, with 5 always rounded upwards.

Usage

round2(x, n)

Arguments

x

the data to be rounded

n

the number of digits to round to

Details

This function differs from round, which rounds 5 "towards the even number". Rounding 5s up leads to bias when positive and negative numbers are expected, but can be desired in some cases.