octmode
Display Integers in Octal or Hexadecimal

### Description

Classes to make the display format of integers be base 8 (octal) or base 16 (hexadecimal) instead of the usual base 10.

### Usage

    as.octmode(x)
    ## S3 method for class 'octmode':
    format(x, width = NULL, ...)
    ## S3 method for class 'octmode':
    print(x, ...)
    ## S3 method for class 'octmode':
    as.character(x, ...)
    ## S3 method for class 'octmode':
    x[i]
    as.hexmode(x)
    ## S3 method for class 'hexmode':
    format(x, width = NULL, upper.case = FALSE, ...)
    ## S3 method for class 'hexmode':
    print(x, ...)
    ## S3 method for class 'hexmode':
    as.character(x, ...)
    ## S3 method for class 'hexmode':
    x[i]

### Arguments

x | An integer or character vector. If character, it should be the octal or hexadecimal representation of an integer (using the letters "A" through "F", upper or lower case, for the hex digits 10 through 15).
width | When converting to character data, make each string at least this long. This is used directly by format, but as.character will pass it on to format.
uppercase | If FALSE, the default, use lowercase "a" through "f" to represent hexadecimal numbers. If TRUE use uppercase "A" through "F".

### Details

Any vector with the class "octmode" or "hexmode" will be specially dealt with by these methods. Do not call the methods by their full names: use, e.g., format(h) and do not use format.hexmode(h) if h was made with as.hexmode(11:20).
There are also special octmode and hexmode methods for the usually logical operations &, |, !, and xor. These do bitwise operations on the underlying integers in the octmode and hexmode objects instead of the the usual Boolean ones.
Other functions will treat "octmode" or "hexmode" objects the same as their underlying "integer" or "integer" equivalents. Many will pass on the "octmode" or "hexmode" class to their outputs.
Value
as.octmode returns its input with the class "octmode" added, as.hexmode returns its input with the class "hexmode" added. The methods for print, format, as.character, and [ return the standard sorts of things for those generics.
See Also
as.roman
Examples

    as.octmode(7:17)
    as.integer(as.octmode("27"))
    format(as.hexmode(c(-2, -1, 0, 10, 20)), width=4)

Package base version 6.1.5-18
Package Index