Learn R Programming

smallstuff (version 1.0.3)

round2: Round to the Nearest Number

Description

Round to the nearest number with the number of digits as indicated. NOTE: Unlike the base round function it rounds a 5 to the higher number, rather than the nearest even number.

Usage

round2(x, digits = 0)

Value

Number rounded to the number of digits indicated

Arguments

x

number to be rounded

digits

number of digits to round to

Examples

Run this code
round2(2.5)

Run the code above in your browser using DataLab