\Header{safe.write}{Write a data.frame avoiding exceeding memory limits}
\keyword{internal}{safe.write}
\begin{Description}\relax
This function batches calls to \code{write.table} to avoid
exceeding memory limits for very large data.frames.\end{Description}
\begin{Usage}
\begin{verbatim}
safe.write(value, file, batch, ..., quote.string=FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{value}] a data.frame;
\item[\code{file}] a file object (connection, file name, etc).
\item[\code{batch}] maximum number of rows to write at a time.
\item[\code{...}] any other arguments are passed to \code{write.table}.
\item[\code{quote.string}] logical value passed to \code{write.table}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The function has a while loop invoking \code{\Link{write.table}}
for subsets of \code{batch} rows of \code{value}.  Since this is
a helper function for \code{\Link{mysqlWriteTable}} has hardcoded
other arguments to \code{write.table}.\end{Details}
\begin{Value}
\code{NULL}, invisibly.\end{Value}
\begin{Note}\relax
No error checking whatsoever is done.\end{Note}
\begin{SeeAlso}\relax
\code{\Link{write.table}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
   ctr.file <- file("dump.sqloader", "w")
   safe.write(big.data, file = ctr.file, batch = 25000)

\end{ExampleCode}
\end{Examples}

