\HeaderA{zip.file.extract}{Extract File from a Zip Archive}{zip.file.extract}
\keyword{file}{zip.file.extract}
\begin{Description}\relax
This will extract the file named \code{file} from the zip archive,
if possible, and write it in a temporary location.
\end{Description}
\begin{Usage}
\begin{verbatim}
zip.file.extract(file, zipname = "R.zip",
                 unzip = getOption("unzip"))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{file}] A file name. (If a path is given, see \sQuote{Note}.)
\item[\code{zipname}] The file name (not path) of a \code{zip} archive,
including the \code{".zip"} extension if required.
\item[\code{unzip}] character string: the method to be used, an empty string
indicates \code{"internal"}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
All platforms support an \code{"internal"} unzip: this is the default
under Windows and the fall-back under Unix if no \code{unzip} program
was found during configuration and \env{R\_UNZIPCMD} is not set.

The file will be extracted if it is in the archive and any required
\code{unzip} utility is available.  It will be extracted to the
directory given by \code{tempdir}, overwriting any existing file of
that name.
\end{Details}
\begin{Value}
The name of the original or extracted file.  Success is indicated by
returning a different name.
\end{Value}
\begin{Note}\relax
The \code{"internal"} method is very simple, and will not set file dates.

This is a helper function for \code{\LinkA{help}{help}},
\code{\LinkA{example}{example}} and \code{\LinkA{data}{data}}.  As such, it handles
file paths in an unusual way.  Any path component of \code{zipname} is
ignored, and the path to \code{file} is used only to determine the
directory within which to find \code{zipname}.
\end{Note}

