EVOLUTION-MANAGER
Edit File: numeric_version.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Numeric Versions</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for numeric_version {base}"><tr><td>numeric_version {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Numeric Versions</h2> <h3>Description</h3> <p>A simple S3 class for representing numeric versions including package versions, and associated methods.</p> <h3>Usage</h3> <pre> numeric_version(x, strict = TRUE) package_version(x, strict = TRUE) R_system_version(x, strict = TRUE) getRversion() </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a character vector with suitable numeric version strings (see ‘Details’); for <code>package_version</code>, alternatively an R version object as obtained by <code><a href="Version.html">R.version</a></code>.</p> </td></tr> <tr valign="top"><td><code>strict</code></td> <td> <p>a logical indicating whether invalid numeric versions should results in an error (default) or not.</p> </td></tr> </table> <h3>Details</h3> <p>Numeric versions are sequences of one or more non-negative integers, usually (e.g., in package ‘<span class="file">DESCRIPTION</span>’ files) represented as character strings with the elements of the sequence concatenated and separated by single <span class="samp">.</span> or <span class="samp">-</span> characters. <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> package versions consist of at least two such integers, an <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> system version of exactly three (major, minor and patchlevel). </p> <p>Functions <code>numeric_version</code>, <code>package_version</code> and <code>R_system_version</code> 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. </p> <p><code>getRversion</code> returns the version of the running <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> as an R system version object. </p> <p>The <code>[[</code> operator extracts or replaces a single version. To access the integers of a version use two indices: see the examples. </p> <h3>See Also</h3> <p><code><a href="../../utils/html/compareVersion.html">compareVersion</a></code>; <code><a href="../../utils/html/packageDescription.html">packageVersion</a></code> for the version of a specific <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> package. <code><a href="Version.html">R.version</a></code> etc for the version of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> (and the information underlying <code>getRversion()</code>). </p> <h3>Examples</h3> <pre> 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 x <- c(x, package_version("0.0")) is.na(x)[4] <- TRUE stopifnot(identical(is.na(x), c(rep(FALSE,3), TRUE)), anyNA(x)) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>