Learn R Programming

SciencesPo (version 1.3.7)

rounded: Round numbers with no leading zero

Description

Round numbers with no leading zero

Usage

rounded(x, digits = 2, add = TRUE, max = (digits + 3))

Arguments

x
A numeric vector of values to be rounded.
digits
An integer for the number of digits to round to.
add
An optional dichotomous indicator for whether additional digits should be added if no numbers appear in pre-set digit level.
max
Maximum number of digits to be shown if add=TRUE.

Examples

Run this code
rounded(seq(0, 1, by=.1))

Run the code above in your browser using DataLab