Skip to contents

Use these functions to turn a number into a string of Unicode digits from another numeral system. numr_replace() takes character vectors and uses string replacement. numr_substitute() takes a numeric vector.

Usage

numr_replace(x, system)

numr_substitute(x, system)

Arguments

x

Input vector.

system

Two-letter language code of the replacement numeral system.

Value

Character vector the same length as x with numerals replaced.

Details

numr_substitute() is vectorised over x and system, which are recycled to their common length. numr_replace() is vectorised over x.

Examples

numr_replace("0123456789", "fa")
#> [1] "۰۱۲۳۴۵۶۷۸۹"
numr_substitute(0123459789, "fa")
#> [1] "۱۲۳۴۵۹۷۸۹"