Skip to contents

Is the package installed and a specific version?

Usage

isPackageVersion(x, op = ">=")

Arguments

x

character. Named character vector. Name corresponds to package name, and value corresponds to minimum version.

op

character(1). Mathematical operator. Defaults to less than or equal to.

Functions

  • isPackageVersion(): Vectorized.

Note

Updated 2023-10-06.

Examples

## TRUE ====
isPackageVersion(
    x = c(
        "base" = utils::packageVersion("base"),
        "utils" = utils::packageVersion("utils")
    ),
    op = "=="
)
#> [1] TRUE TRUE

## FALSE ====
isPackageVersion(
    x = c(
        "base" = utils::packageVersion("base"),
        "utils" = utils::packageVersion("utils")
    ),
    op = ">"
)
#> [1] FALSE FALSE