\HeaderA{print}{Print Values}{print}
\methaliasA{print.factor}{print}{print.factor}
\methaliasA{print.htest}{print}{print.htest}
\methaliasA{print.listof}{print}{print.listof}
\aliasA{print.simple.list}{print}{print.simple.list}
\aliasA{print.table}{print}{print.table}
\keyword{print}{print}
\begin{Description}\relax
\code{print} prints its argument and returns it \emph{invisibly} (via
\code{\LinkA{invisible}{invisible}(x)}).  It is a generic function which means that
new printing methods can be easily added for new
\code{\LinkA{class}{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{\LinkA{print.default}{print.default}}.
\item[\code{na.print}] character string (or \code{NULL}) indicating
\code{\LinkA{NA}{NA}} values in printed output, see
\code{\LinkA{print.default}{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{\LinkA{format}{format}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The default method, \code{\LinkA{print.default}{print.default}} has its own help page.
Use \code{\LinkA{methods}{methods}("print")} to get all the methods for the
\code{print} generic.

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

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

See \code{\LinkA{noquote}{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{\LinkA{print.default}{print.default}}, and help for the
methods above; further \code{\LinkA{options}{options}}, \code{\LinkA{noquote}{noquote}}.

For more customizable (but cumbersome) printing, see
\code{\LinkA{cat}{cat}}, \code{\LinkA{format}{format}} or also \code{\LinkA{write}{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
attenu$station ## 117 levels -> `max.levels' depending on width

## ordered factors: 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}

