# Each components are concatenated with a dot
new_pre_release_ids("rc", 1:3)
ids <- parse_pre_release_ids(
c("", "alpha.beta", "alpha.1", "beta", "beta.11", "beta.2")
)
ids
# Empty ids have the highest precedence
# (Used to indicate not a pre-release version)
vctrs::vec_sort(ids)
# Can be compared with string notation
ids[ids > "beta.2"]
# Limitations:
# 1. When comparing with a string, the number of identifiers in the string
# must not exceed 5.
try(ids[ids > "beta.2.3.4.5.6"])
# This works since the string is parsed first.
ids[ids > parse_pre_release_ids("beta.2.3.4.5.6")]
# 2. When assigning, the number of identifiers in the value being assigned
# must not exceed the number of identifiers in the target or 5,
# whichever is larger.
try(ids[1] <- parse_pre_release_ids("beta.2.3.4.5.6"))
Run the code above in your browser using DataLab