\Header{dput}{Write an Internal Object to a File}
\alias{dget}{dput}
\keyword{file}{dput}
\keyword{programming}{dput}
\keyword{connection}{dput}
\begin{Description}\relax
Writes an ASCII text representation of an \R{} object to a file
or connection, or uses one to recreate the object.
\end{Description}
\begin{Usage}
\begin{verbatim}
dput(x, file = "")
dget(file)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an object.
\item[\code{file}] either a character string naming a file or a
connection. \code{""} indicates output to the console.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{dput} opens \code{file} and deparses the object \code{x} into
that file.  The object name is not written (contrary to \code{dump}).
If \code{x} is a function the associated environment is stripped.
Hence scoping information can be lost.

Using \code{dget}, the object can be recreated (with the limitations
mentioned above).

\code{dput} will warn if fewer characters were written to a file than
expected, which may indicate a full or corrupt file system.
\end{Details}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\Link{deparse}}, \code{\Link{dump}}, \code{\Link{write}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Write an ASCII version of mean to the file "foo"
dput(mean, "foo")
## And read it back into 'bar'
bar <- dget("foo")
unlink("foo")
\end{ExampleCode}
\end{Examples}

