% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/zzz.R
\name{ClosestVersion}
\alias{ClosestVersion}
\title{Find the closest version}
\usage{
ClosestVersion(
  query,
  targets,
  direction = c("min", "max"),
  inclusive = direction == "min"
)
}
\arguments{
\item{query}{A query version (\code{\link[base]{character}} or
\code{\link[base]{numeric_version}})}

\item{targets}{A vector of target versions (\code{\link[base]{character}} or
\code{\link[base]{numeric_version}})}

\item{direction}{Which way should we check for closest version? Choose from:
\describe{
 \item{min}{Closest version less than or equal to \code{query}}
 \item{max}{Closest version greater than or equal to \code{query}}
}}

\item{inclusive}{Perform an inclusive comparison (eg. \code{>=} or \code{<=}
versus to \code{>} or \code{<}) for \dQuote{rounding}}
}
\value{
The version from \code{targets} that is closest to \code{query} as a
\code{\link[base]{character}} vector
}
\description{
API changes happen at set versions, and knowing how a current running version
relates to versions introducing API changes is important.
\code{ClosestVersion} approximages both \dQuote{rounding down} (eg. to
determine minimum version with new API addition) and \dQuote{rounding up}
(eg. to determine maximum version before API deletion) for semantic versions.
}
\examples{
\donttest{
SeuratDisk:::ClosestVersion('3.1.0', targets = c('3.0.0', '1.4.9', '4.3.2'))
SeuratDisk:::ClosestVersion('3.1.0', targets = c('3.0.0', '1.4.9', '4.3.2'), direction = 'max')
}

}
\seealso{
\code{\link[base]{numeric_version}}
}
\keyword{internal}
