From murdoch at stats.uwo.ca  Mon May  1 18:23:47 2006
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon, 01 May 2006 12:23:47 -0400
Subject: [Rd] format.info() versus format.default():  Comments please
Message-ID: <44563613.3070903@stats.uwo.ca>

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



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