% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topn.R
\name{topn}
\alias{topn}
\title{Select indices of the top-n highest values}
\usage{
topn(x, n)
}
\arguments{
\item{x}{A numeric vector.}

\item{n}{Number of top elements to select. If \code{n > length(x)}, all indices are returned.}
}
\value{
An integer vector of indices corresponding to the top-n elements in \code{x}.
}
\description{
Utility function returning indices of the top-n elements in a numeric vector.
Ties are broken randomly.
}
\examples{
x <- c(5, 1, 3, 9, 7)
topn(x, 3)

}
