Skip to contents

This convenience function converts a power of ten to words, such as "Ones Place" or "hundredths digit".

Usage

powerToOrdinal(
  power_10,
  strCase = c("Title", "lower", "UPPER"),
  strAfter = character()
)

Arguments

power_10

integer The 10s place to check, as a power of 10.

strCase

character Whether to display text in "Title" case, "lower" case, or "UPPER" case.

strAfter

character Additional text to add after the ordinal, such as "place" or "digit".

Value

The tens place expressed in words.

Examples

powerToOrdinal(0)
#> [1] "Ones"
powerToOrdinal(3)
#> [1] "Thousands"
powerToOrdinal(-2)
#> [1] "Hundredths"
powerToOrdinal(-2, strAfter = "digit")
#> [1] "Hundredths Digit"