I have a vector of strings consisting of n letters, for example "ABCDEF"
I need to map this to some unique number. Of course, the intuitive approach is to extract all single letters letter and then match them one by one to the corresponding number via
match(letter,LETTERS)
But that leads to too large numbers for large n, because I need 2 digits for every single one of the letters (from 01to 26).
My idea is now to match each combination of strings to a unique number between 1and 26^n, making use of the fact that 26^n has less than 2n digits for large n.
For example for n=4 we get "AAAA" -> 1 and "ZZZZ" -> 26^4
How can I do this in R?