Convert numbers to denominator character vectors (whole, half, third)

denominator(
x,
numerator = 1,
quarter = get_config("nombre::quarter", TRUE),
...
)
nom_denom(x, numerator = 1, quarter = get_config("nombre::quarter", TRUE), ...)

## Arguments

x |
A numeric vector |

numerator |
A numeric vector.
The numerator(s) associated with the denominator(s).
When `numerator` is not `1` or `-1` , the denominator will be pluralized. |

quarter |
A logical of length one.
If `TRUE` , the denominator of `4` will be "quarter(s)".
If `FALSE` , the denominator of `4` will be "fourth(s)".
Defaults to `TRUE` .
Default can be changed with
set_config("nombre::quarter"). |

... |
Additional arguments passed to `ordinal()` |

## Value

A character vector of the same length as `x`

## See also

## Examples

nom_denom(2)

#> [1] "half"

nom_denom(1:10)

#> [1] "whole" "half" "third" "quarter" "fifth" "sixth" "seventh"
#> [8] "eighth" "ninth" "tenth"

nom_denom(1:10, numerator = 2)

#> [1] "wholes" "halves" "thirds" "quarters" "fifths" "sixths"
#> [7] "sevenths" "eighths" "ninths" "tenths"

nom_denom(1:10, numerator = 1:10)

#> [1] "whole" "halves" "thirds" "quarters" "fifths" "sixths"
#> [7] "sevenths" "eighths" "ninths" "tenths"

nom_denom(4)

#> [1] "quarter"

nom_denom(4, quarter = FALSE)

#> [1] "fourth"

nom_denom(1:10, numerator = 2, cardinal = FALSE)

#> [1] "wholes" "halves" "3rds" "4ths" "5ths" "6ths" "7ths" "8ths"
#> [9] "9ths" "10ths"

nom_denom(5:15, numerator = 2, max_n = 10)

#> [1] "fifths" "sixths" "sevenths" "eighths" "ninths" "tenths"
#> [7] "11ths" "12ths" "13ths" "14ths" "15ths"