Learn R Programming

fritools (version 3.3.0)

round_half_away_from_zero: Round Half Away From Zero

Description

Commercial rounding is done a lot, especially with invoices. There is even standard 1333 by the German Institute for Standardization. round rounds half to even, see round's Details section.

round_commercially is just a link to round_half_away_from_zero.

Usage

round_half_away_from_zero(x, digits = 0)

round_commercially(x, digits = 0)

Arguments

x

A number to be rounded.

digits

The number of digits, as in round.

Value

The rounded number.

See Also

Other bits and pieces: golden_ratio(), is_difftime_less(), is_valid_primary_key(), r_cmd_install(), str2num(), strip_off_attributes(), tapply(), throw(), weighted_variance()

Examples

Run this code
# NOT RUN {
x <- 22.5
round_half_away_from_zero(x)
round(x)
round_half_away_from_zero(-x)
round(-x)
# }

Run the code above in your browser using DataLab