Learn R Programming

tidytidbits (version 0.3.2)

as_formatted_number: Format numeric value for output

Description

Vectorised conversion

Usage

as_formatted_number(x, decimal_places = 1, remove_trailing_zeroes = T)

Arguments

x

Numeric vector

decimal_places

Decimal places to display

remove_trailing_zeroes

If the required decimal places are less than decimal places, should resulting trailing zeros be removed?

Value

Character vector

Examples

Run this code
# NOT RUN {
as_formatted_number(0.74167, 2) # gives "0.74"
# }

Run the code above in your browser using DataLab