ratio {nombre} | R Documentation |
Convert numbers to ratio character vectors (two to one, one in three, five out of ten)
Description
Convert numbers to ratio character vectors (two to one, one in three, five out of ten)
Usage
ratio(x, sep = "in", max_n = Inf, negative = "negative", ...)
nom_ratio(x, sep = "in", max_n = Inf, negative = "negative", ...)
Arguments
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
|
Details
x
is converted to a fraction by fracture::frac_mat()
.
Value
A character vector of the same length as x
See Also
Other number names:
adverbial()
,
cardinal()
,
collective()
,
denominator()
,
numerator()
,
ordinal()
Examples
paste0("Our team is outnumbered ", nom_ratio(10), ".")
paste0("The chances of winning are ", nom_ratio(1/1000000, sep = "in"), ".")
nom_ratio(c(1, 10, 100))
nom_ratio(c(0, 0.5, 1.5))
nom_ratio(c(0, 0.125, 0.625, 1), sep = "out of", common_denom = TRUE)
nom_ratio(5 / 10, sep = "in", base_10 = TRUE)
nom_ratio(6 / 25, sep = "in")
nom_ratio(6 / 25, sep = "out of", max_denom = 10)