Convert or print integers in hexadecimal format, with as many digits as are needed to display the largest, using leading zeroes as necessary.
as.hexmode(x) ## S3 method for class 'hexmode' as.character(x, ...) ## S3 method for class 'hexmode' format(x, width = NULL, upper.case = FALSE, ...) ## S3 method for class 'hexmode' print(x, ...)
An object, for the methods inheriting from class
a logical indicating whether to use upper-case letters or lower-case letters (default).
further arguments passed to or from other methods.
"hexmode" consists of integer vectors with that class
attribute, used merely to ensure that they are printed in hex.
width = NULL (the default), the output is padded with
leading zeroes to the smallest width needed for all the non-missing
as.hexmode can convert integers (of type
"double") and character vectors whose elements contain only
A-F (or are
NA) to class
There is a
! method and methods for
these recycle their arguments to the length of the longer and then
apply the operators bitwise to each element.
sprintf for other options in
converting integers to hex,
strtoi to convert hex
strings to integers.
i <- as.hexmode("7fffffff") i; class(i) identical(as.integer(i), .Machine$integer.max) hm <- as.hexmode(c(NA, 1)); hm as.integer(hm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.