format_num: Format numbers with commas

View source: R/format_num.R

format_numR Documentation

Format numbers with commas

Description

Formats numbers with thousand delimited commas. Values of less than 10 are represented as words by default.

Usage

format_num(number, less_than_10_as_words = TRUE)

Arguments

number

A number.

less_than_10_as_words

A logical determining whether values less than 10 are represented as words.

Value

A character object.

Examples

format_num("1000") # returns "1,000"
format_num("1") # returns 'one'
format_num("7", less_than_10_as_words = FALSE) # returns "7"

moj-analytical-services/mojrap documentation built on July 30, 2023, 4:43 p.m.