dec_to_bin | R Documentation |
Get the binary representation of any decimal number from 0 to (2^31) - 1. Doesn't work for larger numbers.
dec_to_bin(decimal_num, bits = 32)
decimal_num |
decimal number between 0 and (2^31) - 1 |
bits |
number of bits to keep in the result counting from the right. Default value is 32. |
a binary string representation of the given decimal number.
# representing 0
dec_to_bin(0,1)
dec_to_bin(0,10)
dec_to_bin(0,32)
dec_to_bin(0)
# representing 24
dec_to_bin(24,6)
dec_to_bin(24,21)
dec_to_bin(24)
dec_to_bin(24,3) # note that this will cut the returned result so be careful!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.