\HeaderA{print.default}{Default Printing}{print.default}
\keyword{print}{print.default}
\begin{Description}\relax
\code{print.default} is the \emph{default} method of the generic
\code{\LinkA{print}{print}} function which prints its argument.
\end{Description}
\begin{Usage}
\begin{verbatim}
## Default S3 method:
print(x, digits = NULL, quote = TRUE, na.print = NULL,
      print.gap = NULL, right = FALSE, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] the object to be printed.
\item[\code{digits}] a non-null value for \code{digits} specifies the minimum
number of significant digits to be printed in values.  The default,
\code{NULL}, uses \code{\LinkA{getOption}{getOption}(digits)}.  (For the
intepretation for complex numbers see \code{\LinkA{signif}{signif}}.)
Non-integer values will be rounded down, and only values
greater than or equal to one are accepted.

\item[\code{quote}] logical, indicating whether or not strings
(\code{\LinkA{character}{character}}s) should be printed with surrounding quotes.
\item[\code{na.print}] a character string which is used to indicate
\code{\LinkA{NA}{NA}} values in printed output, or \code{NULL} (see Details)
\item[\code{print.gap}] a non-negative integer \eqn{\le 1024}{<= 1024},
or \code{NULL} (meaning 1), giving the spacing between adjacent
\dQuote{columns} in printed vectors, matrices and arrays.
\item[\code{right}] logical, indicating whether or not strings should be
right aligned.  The default is left alignment.
\item[\code{...}] further arguments to be passed to or from other
methods.  They are ignored in this function.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The default for printing \code{NA}s is to print \code{NA} (without
quotes) unless this is a character \code{NA} \emph{and} \code{quote =
    FALSE}, when \code{<NA>} is printed.

The same number of decimal places is used throughout a vector,  This
means that \code{digits} specifies the minimum number of significant
digits to be used, and that at least one entry will be encoded with
that minimum number.  However, if all the encoded elements then have
trailing zeroes, the number of decimal places is reduced until at
least one element has a non-zero final digit.  Decimal points are only
included if at least one decimal place is selected.

Attributes are printed respecting their class(es), using the values of
\code{digits} to \code{print.default}, but using the default values
(for the methods called) of the other arguments.

When the \pkg{methods} package is attached, \code{print} will call
\code{\LinkA{show}{show}} for \R{} objects with formal classes if called
with no optional arguments.
\end{Details}
\begin{Section}{Single-byte locales}
If a non-printable character is encountered during output, it is
represented as one of the ANSI escape sequences (\code{\\a}, \code{\\b},
\code{\\f}, \code{\\n}, \code{\\r}, \code{\\t}, \code{\\v}, \code{\bsl{}\bsl{}} and
\code{\\0}: see \LinkA{Quotes}{Quotes}), or failing that as a 3-digit octal
code: for example the UK currency pound sign in the C locale (if
implemented correctly) is printed as \code{\\243}.  Which characters
are non-printable depends on the locale.
\end{Section}
\begin{Section}{Unicode and other multi-byte locales}
In all locales, the characters in the ASCII range (\code{0x00} to
\code{0x7f}) are printed in the same way, as-is if printable, otherwise
via ANSI escape sequences or 3-digit octal escapes as described for
single-byte locales.

Multi-byte non-printing characters are printed as an escape sequence
of the form \code{\\uxxxx}
or \code{\\Uxxxxxxxx}
(in hexadecimal).  This is the internal code for the wide-character
representation of the character, which for all currently known
\R{} platforms is the Unicode code point.

It is possible to have a character string in a character vector that
is not valid in the current locale.  If a byte is encountered that is
not part of a valid character it is printed in hex in the form
\code{<xx>} and this is repeated until the start of a valid character.
(This will rapidly recover from minor errors in UTF-8.)
\end{Section}
\begin{SeeAlso}\relax
The generic \code{\LinkA{print}{print}}, \code{\LinkA{options}{options}}.
The \code{"\LinkA{noquote}{noquote}"} class and print method.

\code{\LinkA{encodeString}{encodeString}}, which encodes a character vector the way
it would be printed.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
pi
print(pi, digits = 16)
LETTERS[1:16]
print(LETTERS, quote = FALSE)
\end{ExampleCode}
\end{Examples}

