It is possible to write a short function to do the conversion in R using the modulo operator (%%) and division. That R is 1-indexed makes it a bit trickier as well as fact that the representation is not really a basis since 0 does not exist, and if we had A = 0 instead we would have BA=26 and no AA, AB etc.
The following function solves this and matches your definition.
base26_conversion <- function(number){
result <- "";
base <- 26
number <- number - 1
repeat{
result <- paste0(LETTERS[(number) %% base + 1], result)
number <- floor(number / base) - 1
if (!(number > -1)){
break
}
}
return(result)
}
The modulo operator will extract the current "digit" and the addition of 1 will correct the index to get the corresponding letter. The division will shift the decimal point by one digit in the 26-base. The subtraction of 1 makes sure that to exclude "0".
The function gives matching strings for the entire input range of your function and should generalize to any positive number.