hex2bin | R Documentation |
A simple-to-use function for converting a logical ('binary') vector into hex code and reverse.
hex2bin(hexcode) bin2hex(binvec)
hexcode |
a single-element character denoting an integer in hexcode (admissible character: 0 to 9, ato f) |
binvec |
a logical vector (alternatively a vector coercible into logical) |
The argument is an integer in binary form (such as "101"), provided as a
logical (c(T,F,T)
) or numeric vector (c(1,0,1)
).
bin2hex
then returns a character denoting this number in hexcode (in
this case "5").
The function hex2bin
does the reverse operation, e.g.
hex2bin("5")
gives (c(1,0,1)
).
bin2hex
returns a single element character; hex2bin
returns a numeric vector equivalent to a logical vector
hex2bin
for converting hexcode into binary vectors,
format.hexmode
for a related R function.
Check http://bms.zeugner.eu for additional help.
bin2hex(c(TRUE,FALSE,TRUE,FALSE,TRUE,TRUE)) bin2hex(c(1,0,1,0,1,1)) hex2bin("b8a") bin2hex(hex2bin("b8a"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.