% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/first_last.r
\name{rm.first}
\alias{rm.first}
\alias{rm.first.default}
\alias{rm.first<-}
\alias{rm.first<-.default}
\alias{rm.last}
\alias{rm.last.default}
\alias{rm.last<-}
\alias{rm.last<-.default}
\title{Remove First or Last N Elements}
\usage{
rm.first(x, n = 1L, ...)

\method{rm.first}{default}(x, n = 1L, ...)

rm.first(x, ...) <- value

\method{rm.first}{default}(x, ...) <- value

rm.last(x, n = 1L, ...)

\method{rm.last}{default}(x, n = 1L, ...)

rm.last(x, ...) <- value

\method{rm.last}{default}(x, ...) <- value
}
\arguments{
\item{x}{an \strong{R} object with a \code{[} method, e.g., a vector, matrix, list.}

\item{n}{integer, number of elements to remove from the beginning or end.}

\item{...}{additional arguments passed to methods.}

\item{value}{integer, same as \code{n}.}
}
\value{
The modified object with the first or last \code{n} elements removed.
}
\description{
Remove the first or last \code{n} elements of an \strong{R} object.
}
\details{
The default methods operate on atomic
vectors and lists, removing \code{n} elements from the beginning or end of
the object.

Dimensional objects (\link{matrix}, \link{data.frame}, \link{array}, etc.) are handled by
removing \code{n} entries along the first dimension ('row-wise' for
matrices/data.frames and for each slice of higher-dimensional arrays).
Remaining dimensions are preserved.
}
\examples{
x <- 1:10
rm.first(x, 3)
rm.last(x, 3)

x <- matrix(1:10, nrow = 5)
rm.first(x, 2)
rm.last(x, 2)

x <- list(a = 1, b = 2, c = 3, d = 4)
rm.first(x, 2)
rm.last(x, 2)

x <- 1:10
rm.first(x) <- 3
rm.last(x) <- 3
x
}
