Convert a integer into a corresponding letter or multi-letter string
Source:R/as_numbered_labels.R
int_to_alpha.Rd
Character values in the provided dict (default to letters "A" to "Z") are passed as is. Non-integer numeric values or characters that are not found in the provided dict are converting to NA values.
Source
Adapted from the recursive solution provided by G. Grothendieck in a May 31, 2017 StackOverflow answer.
Arguments
- x
An integer vector or a vector that can be coerced to an integer vector
- suffix
Suffix character to follow alpha character, e.g. if
x = 1
andsuffix = "."
the returned label would be "A.". suffix is also used to separate values when x is greater than base, e.g.x = 27
andsuffix = "."
returns "A.A." Defaults toNULL
.- base
If base is not numeric, it is converted to an integer with
alpha_to_int()
.- dict
Character vector to compare to x. Default: LETTERS.
- quiet
If
TRUE
, suppress warnings for introduction of NA values through coercion.