Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

numeric_version: Numeric Versions

numeric_versionR Documentation

Numeric Versions

Description

A simple S3 class for representing numeric versionsincluding package versions, and associated methods.

Usage

numeric_version(x, strict = TRUE)package_version(x, strict = TRUE)R_system_version(x, strict = TRUE)getRversion()

Arguments

x

a character vector with suitable numeric version strings (see‘Details’); forpackage_version, alternatively an Rversion object as obtained byR.version.

strict

a logical indicating whether invalid numeric versionsshould results in an error (default) or not.

Details

Numeric versions are sequences of one or more non-negative integers,usually (e.g., in package ‘DESCRIPTION’ files) represented ascharacter strings with the elements of the sequence concatenated andseparated by single. or- characters.R packageversions consist of at least two such integers, anR system versionof exactly three (major, minor and patchlevel).

Functionsnumeric_version,package_version andR_system_version create a representation from such strings (ifsuitable) 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 suchrepresentations.

getRversion returns the version of the runningR as an Rsystem version object.

The[[ operator extracts or replaces a single version. Toaccess the integers of a version use two indices: see the examples.

See Also

compareVersion;packageVersion for the version of a specificR package.R.version etc for the version ofR (and the informationunderlyinggetRversion()).

Examples

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$majorx$minorif(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 integerx[[2, 3]] <- 0   # zero the patchlevelx[[c(2, 3)]] <- 0 # samexx[[3]] <- "2.2.3"; xx <- c(x, package_version("0.0"))is.na(x)[4] <- TRUEstopifnot(identical(is.na(x), c(rep(FALSE,3), TRUE)),  anyNA(x))

What can we improve?

R Package Documentation

Browse R Packages

We want your feedback!

Note that we can't provide technical support on individual packages. You should contact the package authors for that.

 
Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, readEmbedding Snippets.

Close

[8]ページ先頭

©2009-2026 Movatter.jp