Learn R Programming

broman (version 0.72-4)

myround: Round a number, preserving extra 0's

Description

Round a number, preserving extra 0's.

Usage

myround(x, digits = 1)

Arguments

x

Number to round.

digits

Number of digits past the decimal point to keep.

Value

A vector of character strings.

Details

Uses base::sprintf() to round a number, keeping extra 0's.

See Also

base::round(), base::sprintf()

Examples

Run this code
# NOT RUN {
myround(51.01, 3)
myround(0.199, 2)

# }

Run the code above in your browser using DataLab