\HeaderA{numeric\_version}{Numeric Versions}{numeric.Rul.version}
\aliasA{\$.package\_version}{numeric\_version}{.Rdol..package.Rul.version}
\aliasA{.decode\_numeric\_version}{numeric\_version}{.decode.Rul.numeric.Rul.version}
\aliasA{.encode\_numeric\_version}{numeric\_version}{.encode.Rul.numeric.Rul.version}
\aliasA{.make\_numeric\_version}{numeric\_version}{.make.Rul.numeric.Rul.version}
\aliasA{as.character.numeric\_version}{numeric\_version}{as.character.numeric.Rul.version}
\aliasA{as.data.frame.numeric\_version}{numeric\_version}{as.data.frame.numeric.Rul.version}
\aliasA{as.list.numeric\_version}{numeric\_version}{as.list.numeric.Rul.version}
\aliasA{as.numeric\_version}{numeric\_version}{as.numeric.Rul.version}
\aliasA{as.package\_version}{numeric\_version}{as.package.Rul.version}
\aliasA{c.numeric\_version}{numeric\_version}{c.numeric.Rul.version}
\aliasA{getRversion}{numeric\_version}{getRversion}
\aliasA{is.numeric\_version}{numeric\_version}{is.numeric.Rul.version}
\aliasA{is.package\_version}{numeric\_version}{is.package.Rul.version}
\aliasA{Ops.numeric\_version}{numeric\_version}{Ops.numeric.Rul.version}
\aliasA{package\_version}{numeric\_version}{package.Rul.version}
\aliasA{print.numeric\_version}{numeric\_version}{print.numeric.Rul.version}
\aliasA{R\_system\_version}{numeric\_version}{R.Rul.system.Rul.version}
\aliasA{Summary.numeric\_version}{numeric\_version}{Summary.numeric.Rul.version}
\aliasA{[.numeric\_version}{numeric\_version}{[.numeric.Rul.version}
\aliasA{[[.numeric\_version}{numeric\_version}{[[.numeric.Rul.version}
\aliasA{[[<\Rdash.numeric\_version}{numeric\_version}{[[<.Rdash..numeric.Rul.version}
\keyword{utilities}{numeric\_version}
\begin{Description}\relax
A simple S3 class for representing numeric versions
including package versions, and associated methods.
\end{Description}
\begin{Usage}
\begin{verbatim}
numeric_version(x, strict = TRUE)
package_version(x, strict = TRUE)
R_system_version(x, strict = TRUE)
getRversion()
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a character vector with suitable numeric version strings (see
\sQuote{Details}); for \code{package\_version}, alternatively an R
version object as obtained by \code{\LinkA{R.version}{R.version}}.
\item[\code{strict}] a logical indicating whether invalid numeric versions
should results in an error (default) or not.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Numeric versions are sequences of one or more non-negative integers,
usually (e.g., in package \file{DESCRIPTION} files) represented as
character strings with the elements of the sequence concatenated and
separated by single \samp{.} or \samp{-} characters.  \R{} package
versions consist of at least two such integers, an \R{} system version
of exactly three (major, minor and patchlevel).

Functions \code{numeric\_version}, \code{package\_version} and
\code{R\_system\_version} create a representation from such strings (if
suitable) which allows for coercion and testing, combination,
comparison, summaries (min/max), inclusion in data frames,
subscripting, and printing.  The classes can hold a vector of such
representations.

\code{getRversion} returns the version of the running \R{} as an R
system version object.

The \code{[[} operator extracts or replaces a single version.  To
access the integers of a version use two indices: see the examples.
\end{Details}
\begin{SeeAlso}\relax
\code{\LinkA{compareVersion}{compareVersion}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- package_version(c("1.2-4", "1.2-3", "2.1"))
x < "1.4-2.3"
c(min(x), max(x))
x[2, 2]
x$major
x$minor

if(getRversion() <= "2.5.0") { ## work around missing feature
  cat("Your version of R, ", as.character(getRversion()),
      ", is outdated.\n",
      "Now trying to work around that ...\n", sep = "")
}

x[[c(1,3)]]  # '4' as a numeric vector, same as x[1, 3]
x[1, 3]      # 4 as an integer
x[[2, 3]] <- 0   # zero the patchlevel
x[[c(2,3)]] <- 0 # same
x
x[3] <- "2.2.3"; x
\end{ExampleCode}
\end{Examples}

