compareVersion
Compare Two Package Version Numbers

Description

Compares two package version numbers to see which one is more recent.

Usage

compareVersion(a, b)

Arguments

a a character string containing the first version number to compare.
b a character string containing the second version number to compare.

Details

A version number string contains a sequence of non-negative integers separated by periods or hyphens, such as 1.2 or 1.2-17. compareVersion(a,b) compares those integers lexicographically.
Value
See Also
package_version
Examples
compareVersion("2.0", "2.0-1")  # Returns  -1
compareVersion("2.0-5", "3.0") # Returns  -1
compareVersion("5.1-0","5.0-12")  # Returns 1
compareVersion("3.1-12","3.1-12")  # Returns 0
compareVersion("2.0", NA) # Returns 1
compareVersion(NA, "2.0-1") # Returns -1

Package utils version 6.1.1-7
Package Index