\Header{head}{Return the First or Last Part of an Object}
\methalias{head.data.frame}{head}
\methalias{head.default}{head}
\methalias{head.function}{head}
\methalias{head.matrix}{head}
\alias{tail}{head}
\methalias{tail.data.frame}{head}
\methalias{tail.default}{head}
\methalias{tail.function}{head}
\methalias{tail.matrix}{head}
\keyword{manip}{head}
\begin{Description}\relax
Returns the first or last parts of a vector, matrix, data frame or function.
\end{Description}
\begin{Usage}
\begin{verbatim}
head(x, ...)
## Default S3 method:
head(x, n=6, ...)
## S3 method for class 'data.frame':
head(x, n=6, ...)

tail(x, ...)
## Default S3 method:
tail(x, n=6, ...)
## S3 method for class 'data.frame':
tail(x, n=6, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an object
\item[\code{n}] size for the resulting object: number of elements for a
vector (including lists), rows for a matrix or data frame or
lines for a function.
\item[\code{...}] arguments to be passed to or from other methods.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For matrices and data frames, the first/last \code{n} rows are returned.
For functions, the first/last \code{n} lines of the deparsed function are
returned as character strings.
\end{Details}
\begin{Value}
An object (usually) like \code{x} but generally smaller.
\end{Value}
\begin{Author}\relax
Patrick Burns, improved and corrected by R-core
\end{Author}
\begin{Examples}
\begin{ExampleCode}
data(freeny)
head(freeny.x, n=10)
head(freeny.y)

tail(freeny.x)
tail(freeny.y)

tail(library)
\end{ExampleCode}
\end{Examples}

