TITLE(formatC @@ Flexible Formatting)
USAGE(
formatC(x, digits=NULL, width=max(0,digits)+1,
        format=NULL, flag="", mode=NULL)
)
ALIAS(formatC)
ARGUMENTS(
ARG(x @@ an atomic numerical or character object,
typically a vector of real numbers.)
ARG(digits @@ the desired number of digits after
the decimal point. Default: 2 for integer,
4 for real numbers.  LANG(digits) < 0 uses
the default for C, namely  6 digits.)
ARG(width @@ the total field width; LANG(width < 0)
means left justify the number in this field
(equivalent to LANG(flag ="-")).
It is possible that the result will be longer than this,
but that should only happen in reasonable cases.)
ARG(format @@ equal to LANG("d")  (for integers),
LANG("f"), LANG("e"), LANG("E"), LANG("g"), LANG("G")
(for `real'), or LANG("s") (for strings).
LANG("f") gives numbers in the usual ``xxx.xxx'' format;
LANG("e") and LANG("E") give ``n.ddde<nn>'' or ``n.dddE<nn>''
(scientific  format); LANG("g") and LANG("G") put LANG(x[i])
into scientific format only if it saves space to do so.)
ARG(flag @@ format modifier as in Kernighan and Ritchie, 2nd ed., p.243.
LANG("0")  pads leading zeros; LANG("-") does left adjustment,
others are LANG("+"), LANG(" "), and LANG("#").)
ARG(mode @@ LANG("real"),  LANG("integer") or LANG("character").
Default: Automatic.)
)
VALUE(
A character object of same size and attributes as LANG(x).
Unlike LANG(format), each number is individually formatted.
A for loop over each element of LANG(x), calling LANG(sprintf(DOTS))
is done in the C function LANG(str_signif).
PARA
For  character  arguments,  simple (left or right) padding with
white space is done.
)
NOTE(
This function was originally written by Bill Dunlap
and later much improved by Martin Maechler.
It was adapted for R by Friedrich Leisch.
)
SEEALSO(
LANG(LINK(format)).
)
EXAMPLES(
xx  <- pi*10^(-5:4)
options(digits=4)   # only for format
cbind(format(xx), formatC(xx))
cbind(formatC(xx, wid=9, flag='-'))
cbind(formatC(xx, dig=5,  wid=8, format="f", flag='0'))
BLANK
formatC(c("a", "Abc", "no way"), wid = -7)#  -  <=> flag = '-'
)
