digitsBase(0:12, 8) #-- octal representation
empty.dimnames(digitsBase(0:33, 2)) # binary
## This may be handy for just one number (and default decimal):
digits <- function(n, base = 10) drop(digitsBase(n, base = base))
digits(128, base = 8) # 2 0 0
hexdig <- c(0:9, LETTERS[1:6]) #-- hexadesimal coding :
i <- c(1:20, 100:120) # e.g.
M <- digitsBase(i, 16)
cM <- hexdig[1 + M]; dim(cM) <- dim(M)
sub("^0+","", apply(cM,2,paste, collapse=""))
Run the code above in your browser using DataLab