Learn R Programming

broman (version 0.84)

myround: Round a number, preserving extra 0's

Description

Round a number, preserving extra 0's.

Usage

myround(x, digits = 1)

Value

A vector of character strings.

Arguments

x

Number to round.

digits

Number of digits past the decimal point to keep.

Details

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

See Also

Examples

Run this code
myround(51.01, 3)
myround(0.199, 2)

Run the code above in your browser using DataLab