How to use as.hexmode width

hex, r

Solution

The `width` parameter belongs to `format` (well, `format.hexmode`), not `as.hexmode`:

format(as.hexmode(hex), width=2)

Problem

According to the R documentation: ``` 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, ...) ``` Arguments x An object, for the methods inheriting from class "hexmode". width NULL or a positive integer specifying the minimum field width to be used, with padding by leading zeroes. If I call in R 3.02: ``` > hex <- "5" > as.hexmode(hex,width=2) ``` I get the error: ``` Error in as.hexmode(hex, width = 2) : unused argument (width = 2) ``` How do I call as.hexmode correctly?

Original source