% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/verbs_utility.R
\name{slice_head}
\alias{slice_head}
\alias{slice_tail}
\alias{slice_min}
\alias{slice_max}
\title{Select first or last rows}
\usage{
slice_head(.data, n = 1L)

slice_tail(.data, n = 1L)

slice_min(.data, order_by, n = 1L, with_ties = TRUE)

slice_max(.data, order_by, n = 1L, with_ties = TRUE)
}
\arguments{
\item{.data}{A \code{vectra_node} object.}

\item{n}{Number of rows to select.}

\item{order_by}{Column to order by (for \code{slice_min}/\code{slice_max}).}

\item{with_ties}{If \code{TRUE} (default), includes all rows that tie with the
nth value. If \code{FALSE}, returns exactly \code{n} rows.}
}
\value{
A \code{vectra_node} for \code{slice_head()} and \code{slice_min/max(..., with_ties = FALSE)}. A data.frame for \code{slice_tail()} and
\code{slice_min/max(..., with_ties = TRUE)} (the default), since these must
materialize all rows.
}
\description{
Select first or last rows
}
\examples{
f <- tempfile(fileext = ".vtr")
write_vtr(mtcars, f)
tbl(f) |> slice_head(n = 3) |> collect()
tbl(f) |> slice_min(order_by = mpg, n = 3) |> collect()
tbl(f) |> slice_max(order_by = mpg, n = 3) |> collect()
unlink(f)

}
