[R] hex format
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Apr 7 18:13:24 CEST 2005
On Thu, 7 Apr 2005, Duncan Murdoch wrote:
[...]
> If you want an integer vector to always display in hex, assign a class to it
> and define a print method. I don't think there's a standard library function
> to display in hex, but there are probably packages to do so.
In R 2.1.0-to-be
> x <- as.numeric("0x00B") # this is platform-specific
> x
[1] 11
> sprintf("0x%X", as.integer(x)) # this is not
[1] "0xB"
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list