[Rd] Flag '#' in sprintf() format string "%#x"?

Henrik Bengtsson hb at stat.berkeley.edu
Sun Jun 21 00:44:24 CEST 2009

Hi, this is a bit of FYI, but also a question.

Is flag '#' in sprintf() format string "%#x" fully supported across
platforms?  Can that be assumed?  I discovered thanks to the r-forge
service, that this was not the case for OSX with "R version 2.9.0
Under development (unstable) (2009-01-13 r47593)", where R CMD check
reports the following:

Error in sprintf("%#x", values) :
  use format %d, %i, %x or %X for integer objects

where values <- as.integer(1:5). Note it works well on other
platforms; I don't know about newer R version on OSX.   Should I
consider this a glitch in an old version of R (newer R version do a
much better validation here), or should I simply avoid '#'?



More information about the R-devel mailing list