rd: Round Numbers To Text With No Leading Zero

Description Usage Arguments Value Author(s) Examples

View source: R/rd.r

Description

Rounds numbers to text and drops leading zeros in the process.

Usage

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

Arguments

x

A vector of values to be rounded (must be numeric).

digits

The number of digits to round to (must be an integer).

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.

Value

A vector of length equal to that of x of class character.

Author(s)

Josh Pasek, Assistant Professor of Communication Studies at the University of Michigan (www.joshpasek.com).

Examples

1
rd(seq(0, 1, by=.1))

weights documentation built on June 11, 2021, 1:06 a.m.

Related to rd in weights...