R/ratio.R
ratio.Rd
Convert numbers to ratio character vectors (two to one, one in three, five out of ten)
ratio(x, sep = "in", max_n = Inf, negative = "negative", ...) nom_ratio(x, sep = "in", max_n = Inf, negative = "negative", ...)
x  A numeric vector 

sep  A character vector separating components of the ratio.
Defaults to 
max_n  A numeric vector.
When the absolute value of 
negative  A character vector to append to negative numbers.
Defaults to 
...  Arguments passed on to

A character vector of the same length as x
x
is converted to a fraction by fracture::frac_mat()
.
Other number names:
adverbial()
,
cardinal()
,
collective()
,
denominator()
,
numerator()
,
ordinal()
paste0("Our team is outnumbered ", nom_ratio(10), ".") #> [1] "Our team is outnumbered ten in one." paste0("The chances of winning are ", nom_ratio(1/1000000, sep = "in"), ".") #> [1] "The chances of winning are one in one million." nom_ratio(c(1, 10, 100)) #> [1] "one in one" "ten in one" "one hundred in one" nom_ratio(c(0, 0.5, 1.5)) #> [1] "zero in one" "one in two" "three in two" nom_ratio(c(0, 0.125, 0.625, 1), sep = "out of", common_denom = TRUE) #> [1] "zero out of eight" "one out of eight" "five out of eight" #> [4] "eight out of eight" nom_ratio(5 / 10, sep = "in", base_10 = TRUE) #> [1] "five in ten" nom_ratio(6 / 25, sep = "in") #> [1] "six in twentyfive" nom_ratio(6 / 25, sep = "out of", max_denom = 10) #> [1] "one out of four"