Hyphen (`-`) in R package versions

Viewed 279

A package I'm depending on lists versions like 4.0.4 but also 0.9-7 and even 0.9-7.1. (cf. here).

What does the hyphen (-) mean in package versioning? How is version comparison performed against it? I couldn't find any docs on this.

1 Answers

What does the hyphen (-) mean in package versioning?

The hyphen is mentioned in ?numeric_version:

"Numeric versions are sequences of one or more 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. R package versions consist of at least two such integers."

Here, no distinction is made between the period . and the hyphen -. However, as noted by Hadley & Brian in R Packages; Package metadata - Version:

I don’t recommend taking full advantage of R’s flexibility. Instead always use . to separate version numbers.

They refer to Semantic Versioning, where the use of hyphen is described:

A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version.


How is version comparison performed against it?

For version comparison, see r check if package version is greater than x.y.z and R Packages; Package metadata - Version.

Related