R: Reset version field

reset_version {semver} | R Documentation

## Reset version field

### Description

Reset the version field. "Major", "minor" and "patch" fields are set as integers, "prerelease" and "build" are set with character strings. Fields of lower precedence are reset to default value (0L or "")

### Usage

    reset_version(x, field, value, ...)

    ## S3 method for class 'svptr'
    reset_version(x, field = c("major", "minor", "patch",
      "prerelease", "build"), value, ...)

    ## S3 method for class 'svlist'
    reset_version(x, field, value, ...)

### Arguments

`x` | An object of class "svlist" or "svptr".
`field` | For the "svptr" class a character string detailing the field to set (major, minor etc...). For the "svlist" class a character vector detailing the field to set for each list member.
`value` | The value to set the field to. For fields "major", "minor" and "patch" this is an integer. For fields "prerelease" and "build" this is a character. For the "svptr" class value is a scalar. For the "svlist" class value is a list detailing the value to set for each list member.
`...` | Additional arguments passed on to methods.

### Value

returns an object of class svptr or svlist

### Examples

    semver <- parse_version(c("1.2.3", "1.2.4-alpha+bld1"))
    reset_version(semver[[2]], "major", 1L)
    semver[[1]] <- reset_version(semver[[1]], "major", 2L)
    reset_version(semver, c("minor", "prerelease"), list(3L, "beta"))
    reset_version(semver, c("prerelease"), list("hello", "world"))

[Package semver version 0.2.0 Index]