Type: Package
Title: Sort and Order Version Codes
Version: 1.1.0
Date: 2022-03-23
Description: A lightweight package for sorting version codes in various forms. No strong dependencies guaranteed.
License: GPL (≥ 3)
Encoding: UTF-8
RoxygenNote: 7.1.2
Suggests: covr, spelling, testthat (≥ 3.0.0)
Config/testthat/edition: 3
Language: en-US
NeedsCompilation: no
Packaged: 2022-03-25 00:14:57 UTC; erdar
Author: Laura Bakala [cre, aut, cph]
Maintainer: Laura Bakala <erdaradun.gaztea@gmail.com>
Repository: CRAN
Date/Publication: 2022-03-25 08:10:02 UTC

Find the latest version code

Description

ver_latest() returns the latest of the version codes.

Usage

ver_latest(x)

Arguments

x

character()
A vector of version codes that start with a number (as in "1.5.0"), i.e. without initial "v" (as in "v1.5.0").

Value

A character vector with one element.

See Also

ver_oldest()

Examples

ver_latest(c("1.3-0", "1.4-1", "0.0.0.9000", "1.4-0a", "1.4-0"))


Find the oldest version code

Description

ver_oldest() returns the oldest of the version codes.

Usage

ver_oldest(x)

Arguments

x

character()
A vector of version codes that start with a number (as in "1.5.0"), i.e. without initial "v" (as in "v1.5.0").

Value

A character vector with one element.

See Also

ver_latest()

Examples

ver_oldest(c("1.3-0", "1.4-1", "0.0.0.9000", "1.4-0a", "1.4-0"))


Order version codes

Description

ver_order() returns the permutation that rearranges a vector of version codes alphanumerically.

Usage

ver_order(x)

Arguments

x

character()
A vector of version codes that start with a number (as in "1.5.0"), i.e. without initial "v" (as in "v1.5.0").

Value

An integer vector (for details see order).

See Also

ver_sort()

Examples

version_codes <- c("1.5-0", "1.4-1", "0.0.0.9000", "1.4-0a", "1.4-0")
ver_order(version_codes)
# The line below is the same as ver_sort(version_codes)
version_codes[ver_order(version_codes)]


Sort version codes

Description

ver_sort() returns a sorted vector of version codes, where sorting is done alphanumerically.

Usage

ver_sort(x)

Arguments

x

character()
A vector of version codes that start with a number (as in "1.5.0"), i.e. without initial "v" (as in "v1.5.0").

Value

A character vector containing the same elements as input, but reordered.

See Also

ver_order()

Examples

ver_sort(c("1.5-0", "1.4-1", "0.0.0.9000", "1.4-0a", "1.4-0"))

mirror server hosted at Truenetwork, Russian Federation.