\Header{print}{Print Values}
\methalias{print.factor}{print}
\methalias{print.htest}{print}
\methalias{print.listof}{print}
\alias{print.simple.list}{print}
\alias{print.table}{print}
\keyword{print}{print}
\begin{Description}\relax
\code{print} prints its argument and returns it \emph{invisibly} (via
\code{\Link{invisible}(x)}).  It is a generic function which means that
new printing methods can be easily added for new
\code{\Link{class}}es.
\end{Description}
\begin{Usage}
\begin{verbatim}
print(x, ...)

## S3 method for class 'factor':
print(x, quote = FALSE, max.levels = NULL,
     width = getOption("width"), ...)

## S3 method for class 'table':
print(x, digits = getOption("digits"), quote = FALSE,
          na.print = "", zero.print = "0", justify = "none", ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an object used to select a method.
\item[\code{...}] further arguments passed to or from other methods.
\item[\code{quote}] logical, indicating whether or not strings should be
printed with surrounding quotes.
\item[\code{max.levels}] integer, indicating how many levels should be
printed for a factor; if \code{0}, no extra "Levels" line will be
printed.  The default, \code{NULL}, entails choosing \code{max.levels}
such that the levels print on one line of width \code{width}.
\item[\code{width}] only used when \code{max.levels} is NULL, see above.
\item[\code{digits}] minimal number of \emph{significant} digits, see
\code{\Link{print.default}}.
\item[\code{na.print}] character string (or \code{NULL}) indicating
\code{\Link{NA}} values in printed output, see
\code{\Link{print.default}}.
\item[\code{zero.print}] character specifying how zeros (\code{0}) should be
printed; for sparse tables, using \code{"."} can produce stronger results.
\item[\code{justify}] character indicating if strings should left- or
right-justified or left alone, passed to \code{\Link{format}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The default method, \code{\Link{print.default}} has its own help page.
Use \code{\Link{methods}("print")} to get all the methods for the
\code{print} generic.

\code{print.factor} allows some customization and is used for printing
\code{\Link{ordered}} factors as well.

\code{print.table} for printing \code{\Link{table}}s allows other
customization.

See \code{\Link{noquote}} as an example of a class whose main
purpose is a specific \code{print} method.
\end{Details}
\begin{References}\relax
Chambers, J. M. and Hastie, T. J. (1992)
\emph{Statistical Models in S.}
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
The default method \code{\Link{print.default}}, and help for the
methods above; further \code{\Link{options}}, \code{\Link{noquote}}.

For more customizable (but cumbersome) printing, see
\code{\Link{cat}}, \code{\Link{format}} or also \code{\Link{write}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
ts(1:20)#-- print is the "Default function" --> print.ts(.) is called
rr <- for(i in 1:3) print(1:i)
rr

## Printing of factors
data(attenu)
attenu$station ## 117 levels -> `max.levels' depending on width

data(esoph) ## ordered : levels  "l1 < l2 < .."
esoph$agegp[1:12]
esoph$alcgp[1:12]

## Printing of sparse (contingency) tables
set.seed(521)
t1 <- round(abs(rt(200, df=1.8)))
t2 <- round(abs(rt(200, df=1.4)))
table(t1,t2) # simple
print(table(t1,t2), zero.print = ".")# nicer to read
\end{ExampleCode}
\end{Examples}

