[Rd] format.info() versus format.default(): Comments please

Duncan Murdoch murdoch at stats.uwo.ca
Mon May 1 18:23:47 CEST 2006


The format.info() function currently takes args (x, digits = NULL,
nsmall = 0), while format.default() takes many more:

function (x, trim = FALSE, digits = NULL, nsmall = 0, justify = c("left",
      "right", "centre", "none"), width = NULL, na.encode = TRUE,
      scientific = NA, big.mark = "", big.interval = 3, small.mark = "",
      small.interval = 5, decimal.mark = ".", zero.print = NULL,
      ...)

I think it would make sense for format.info to take at least the width,
scientific, big.*, small.*, and zero.print arguments, as these all
affect the output that format.info is calculating, i.e. the width,
decimal places, and scientific notation digits.  (It would probably be
sensible for it to take all possible format() arguments, but ignore some.)

For example, I was just writing some code to format durations as
HH:MM:SS.SSS (where the number of decimal places on the seconds was
chosen according to the values); here I wanted to tell format not
to use scientific notation, but I needed to use options(scipen=) to do
that because format.info doesn't take the scientific=FALSE argument.

Comments?

Duncan Murdoch



More information about the R-devel mailing list