\HeaderA{toString}{Convert an R Object to a Character String}{toString}
\methaliasA{toString.default}{toString}{toString.default}
\keyword{utilities}{toString}
\begin{Description}\relax
This is a helper function for \code{\LinkA{format}{format}} to produce a single
character string describing an \R{} object.
\end{Description}
\begin{Usage}
\begin{verbatim}
toString(x, ...)

## Default S3 method:
toString(x, width = NULL, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] The object to be converted.
\item[\code{width}] Suggestion for the maximum field width.  Values of
\code{NULL} or \code{0} indicate no maximum.
The minimum value accepted is 6 and smaller values are taken as 6.
\item[\code{...}] Optional arguments passed to or from methods.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This is a generic function for which methods can be written: only the
default method is described here.  Most methods should honor the
\code{width} argument to specify the maximum display width (as measured
by \code{\LinkA{nchar}{nchar}(type = "width"}) of the result.

The default method first converts \code{x} to character and then
concatenates the elements separated by \code{", "}.
If \code{width} is supplied and is not \code{NULL}, the default method
returns the first \code{width - 4} characters of the result with
\code{....} appended, if the full result would use more than
\code{width} characters.
\end{Details}
\begin{Value}
A character vector of length 1 is returned.
\end{Value}
\begin{Author}\relax
Robert Gentleman
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{format}{format}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- c("a", "b", "aaaaaaaaaaa")
toString(x)
toString(x, width=8)
\end{ExampleCode}
\end{Examples}

