Learn R Programming

semver (version 0.2.0)

parse_version: Parse semantic version

Description

Parse a character vector to semantic versions

Usage

parse_version(version)

Arguments

version
A character vector

Value

A list of "svptr" objects. The list itself is of class "svlist"

Examples

Run this code
semver <- parse_version(c("1.2.3", "1.2.4", "1.0.0", "1.2.4-beta", "2.1.3-alpha", "1.9.4"))
max(semver)
ver124a <- semver[semver > "1.2.4-alpha"]
sort(ver124a)
# compare versions
semver[[1]] < semver[[2]]

# compare against a version
semver > semver[1]

# compare against a character string
semver > "1.7.2"

# sort versions
sort(semver)
order(semver)
rank(semver)

# get summary statistics
min(semver)
max(semver)
range(semver)

# coerce versions
as.character(semver)
as.data.frame(semver)

Run the code above in your browser using DataLab