num_to_text: Spell out numbers if they are smaller than ten
Description
Spell out numbers if they are smaller than ten
Usage
num_to_text(
number,
sentence_start = FALSE,
zero_or_no = "no",
uk_or_us = "UK",
big_mark = ","
)
Arguments
- number
Whole number as numeric or integer, to be turned into text. Numbers 1-10 are always written out in full,
regardless of their place in the sentence. Number 11-999 are written out in full if they are at the beginning of a sentence.
Numbers greater than 1000 are returned as numerals.
- sentence_start
Logical. If TRUE, numbers below 100 are written out in full, and their first letter is capitalised.
- zero_or_no
Specify what to print when the number is 0. Defaults to "no". Can be any string.
- uk_or_us
Defaults to UK which adds an "and" between "hundred" and other numbers (e.g. "One hundred and five"). If "US"
is chosen, the "and" is removed (e.g. "One hundred five").
- big_mark
Defaults to "," (e.g. "1,999").
Examples
Run this codenum_to_text(3)
num_to_text(333, sentence_start = TRUE)
Run the code above in your browser using DataLab