Rev 74067 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/hexmode.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2014 R Core Team% Distributed under GPL 2 or later\name{hexmode}\alias{as.hexmode}\alias{format.hexmode}\alias{print.hexmode}\alias{as.character.hexmode}\alias{[.hexmode}\alias{!.hexmode}\alias{|.hexmode}\alias{&.hexmode}%% FIXME: xor() is not generic (yet?).%% \alias{xor.hexmode}\alias{hexmode}\title{Display Numbers in Hexadecimal}\description{Convert or print integers in hexadecimal format, with as many digitsas are needed to display the largest, using leading zeroes asnecessary.}\usage{as.hexmode(x)\method{as.character}{hexmode}(x, \dots)\method{format}{hexmode}(x, width = NULL, upper.case = FALSE, \dots)\method{print}{hexmode}(x, \dots)}\arguments{\item{x}{An object, for the methods inheriting from class \code{"hexmode"}.}\item{width}{\code{NULL} or a positive integer specifying the minimumfield width to be used, with padding by leading zeroes.}\item{upper.case}{a logical indicating whether to use upper-caseletters or lower-case letters (default).}\item{\dots}{further arguments passed to or from other methods.}}\details{Class \code{"hexmode"} consists of integer vectors with that classattribute, used merely to ensure that they are printed in hex.If \code{width = NULL} (the default), the output is padded withleading zeroes to the smallest width needed for all the non-missingelements.\code{as.hexmode} can convert integers (of \link{type} \code{"integer"} or\code{"double"}) and character vectors whose elements contain only\code{0-9}, \code{a-f}, \code{A-F} (or are \code{NA}) to class\code{"hexmode"}.There is a \code{\link{!}} method and methods for \code{\link{|}} and\code{\link{&}}:%% FIXME: xor() is not generic (yet?).%% and \code{\link{xor}}:these recycle their arguments to the length of the longer and thenapply the operators bitwise to each element.}\seealso{\code{\link{octmode}}, \code{\link{sprintf}} for other options inconverting integers to hex, \code{\link{strtoi}} to convert hexstrings to integers.}\examples{i <- as.hexmode("7fffffff")i; class(i)identical(as.integer(i), .Machine$integer.max)hm <- as.hexmode(c(NA, 1)); hmas.integer(hm)}\keyword{utilities}\keyword{print}