asbinary {bestglm} | R Documentation |
A non-negative integer is represented as a binary number. The digits, 0 or 1, of this number are returned in a vector.
to.binary(n, k = ceiling(logb(n+1,base=2)))
n |
a non-negative integers |
k |
number of digits to be returned. |
A vector of length k. The first element is the least significant digit.
A.I. McLeod
to.binary(63)
to.binary(64)
#sometimes we want to pad result with 'leading' 0's
to.binary(63, k=20)
to.binary(64, k=20)