package-version {base}R Documentation

Package versions

Description

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

Usage

package_version(x, strict = TRUE)

getRversion()

Arguments

x a character vector with package version strings.
strict a logical indicating whether invalid package versions should results in an error (default) or not.

Details

R (package) versions are sequences of at least two non-negative integers, usually (e.g., in package ‘DESCRIPTION’ files) represented as character strings with the elements of the sequence concatenated and separated by single . or - characters.

package_version creates a representation from such strings which allows for coercion and testing, combination, comparison, summaries (min/max), inclusion in data frames, subscripting, and printing.

getRversion returns the version of the running R as an object of class "package_version".

See Also

compareVersion

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$major
x$minor

[Package base version 2.2.1 Index]