NEWS.md
NA
, Inf
, and NaN
) no longer produce an error.Inf
is handled like a normal number. nom_card(Inf)
produces "infinity"
and nom_ord(Inf)
produces "infinitieth"
.NA
and NaN
propagate through functions. All functions return NA
for NA
and "NaN"
for NaN
.ordinal()
has been simplified and now runs slightly faster.ratio()
, which generates ratios.ratio("0.5")
generates “one in two”.ratio("1.5", sep = "to")
generates “three to two”.pkgconfig
interface for setting default options.uncardinal()
, which takes a character vector and attempts to convert it to a numeric.uncardinal("twenty-five")
produces 25.uncardinal()
only works with cardinal integers and the result of other nombre functions.nombre
.nombre
s to go through mathematical transformations while preserving their characteristics.cardinal(25) + cardinal(2)
produces "twenty-seven"
.adverbial(3) / 3
produces "once"
.as.numeric(ordinal(9))
produces 9
.options()
.cardinal(3/100)
now produces “three hundredths” rather than “three one-hundredths”.denominator(1)
still produces “whole”.collective()
gains the arguments of_the
, all_n
, and cardinal
.collective(3, all_n = FALSE)
becomes "all"
rather than "all three"
.collective(0:3, of_the = TRUE)
becomes c("none of the", "the", "both of the", "all three of the")
rather than c("no", "the", "both", "all three")
.collective(3, cardinal = FALSE)
becomes "all 3"
rather than "all three"
.set_config("nombre::all_n", "nombre::of_the", "nombre::coll_cardinal")
.cardinal()
loses the argument numerator
.numerator()
/nom_numer()
.cardinal()
to generate fractional components in roughly one tenth the time of the R implementation of decimal_to_fraction()
.fracture::frac_mat()
with ...
.pkgdown
site.cardinal()
gains the argument max_n
, which stops numbers greater that max_n
from being cardinalized. This is useful when you want to print small numbers in words but larger numbers numerically. Refactorization means this argument can be used by all functions.options("nombre.max_n")
sets a default value.adverbial()
and nom_adv()
generate adverbials, e.g. “once”, “twice”, “three times”.thrice = TRUE
or options("nombre.thrice" = TRUE)
convert 3
to “thrice” instead of “three times”....
to lower level functions. ordinal()
and adverbial()
pass to cardinal()
. denominator()
passes to ordinal()
. This allows cardinal()
’s max_n
and negative
to be used by all functions and ordinal()
’s cardinal
to be used by denominator()
.ordinal()
now handles uncardinalized numeric vectors with different numbers of digits correctly. Previously, dashes would be appended to the start of the shorter numbers. nom_ord(c(9, 10), cardinal = FALSE)
now produces “9th, 10th” as expected, instead of “-9th, 10th” as it did previously.Implemented a custom function to convert decimals to fractions. This removes the previous previous dependency on {MASS}.
Added package documentation page at ?nombre