pretty_round: Round and format numeric vectors; standardising trailing...

Description Usage Arguments Value See Also Examples

Description

Round and format numeric vectors; standardising trailing zeros

Usage

1
pretty_round(num, digits = 2, to_pass = c("", " ", "Inf", NaN, NA), ...)

Arguments

num

A numeric or character vector coercible to a numeric vector. Empty character vectors will be returned by the function.

digits

Integer indicating the number of decimal places to be used.

to_pass

A character vector specifying what to pass without reformating, by default this includes; NA, NaN, "Inf", "", and " ".

...

Pass additional arguements to format.

Value

A rounded numeric vector formatted as a character vector with trialing zeros.

See Also

format, and round for additional information

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Rounding a single number
pretty_round(2.1, digits = 1)

## Rounding with trailing whitespace
pretty_round(2.1, digits = 2)

##Rounding a vector
pretty_round(c(2.13, 2.1, 4.165, 8.2323242, 1), digits = 2)

## Passed without rounding
pretty_round(c("", " ", "Inf", NaN, NA), digits = 2)

seabbs/prettypublisher documentation built on May 30, 2019, 10:36 p.m.