\HeaderA{format.info}{format(.) Information}{format.info}
\keyword{character}{format.info}
\keyword{print}{format.info}
\keyword{programming}{format.info}
\begin{Description}\relax
Information is returned on how \code{\LinkA{format}{format}(x, digits, nsmall)}
would be formatted.
\end{Description}
\begin{Usage}
\begin{verbatim}
format.info(x, digits = NULL, nsmall = 0)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an atomic vector; a potential argument of
\code{\LinkA{format}{format}(x, ...)}.
\item[\code{digits}] how many significant digits are to be used for
numeric and complex \code{x}.  The default, \code{NULL}, uses
\code{\LinkA{getOption}{getOption}(digits)}.
\item[\code{nsmall}] (see \code{\LinkA{format}{format}(..., nsmall)}).
\end{ldescription}
\end{Arguments}
\begin{Value}
An \code{\LinkA{integer}{integer}} \code{\LinkA{vector}{vector}} of length 1, 3 or 6, say
\code{r}.

For logical, integer and character vectors a single element,
the width which would be used by \code{format} if \code{width = NULL}.

For numeric vectors:
\begin{ldescription}
\item[\code{r[1]}] width (in characters) used by \code{format(x)}
\item[\code{r[2]}] number of digits after decimal point.
\item[\code{r[3]}] in \code{0:2}; if \eqn{\ge}{>=}\code{1}, \emph{exponential}
representation would be used, with exponent length of \code{r[3]+1}.
\end{ldescription}


For a complex vector the first three elements refer to the real parts,
and there are three further elements corresponding to the imaginary
parts.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{format}{format}}, \code{\LinkA{formatC}{formatC}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
dd <- options("digits") ; options(digits = 7) #-- for the following
format.info(123)   # 3 0 0
format.info(pi)    # 8 6 0
format.info(1e8)   # 5 0 1 - exponential "1e+08"
format.info(1e222) # 6 0 2 - exponential "1e+222"

x <- pi*10^c(-10,-2,0:2,8,20)
names(x) <- formatC(x, width=1, digits=3, format="g")
cbind(sapply(x,format))
t(sapply(x, format.info))

## using at least 8 digits right of "."
t(sapply(x, format.info, nsmall = 8))

# Reset old options:
options(dd)
\end{ExampleCode}
\end{Examples}

