Skip to contents

Wrapper around rlang::is_installed().

Usage

check_pkg_installed(x = character(1L))

assert_pkg_installed(
  x = character(1L),
  .var.name = checkmate::vname(x),
  add = NULL
)

test_pkg_installed(x = character(1L))

expect_pkg_installed(x = character(1L), info = NULL, label = vname(x))

skip_if_pkg_not_installed2(...)

Arguments

x

Name of the package.

.var.name

[character(1)]
The custom name for x as passed to any assert* function. Defaults to a heuristic name lookup.

add

[AssertCollection]
Collection to store assertion messages. See AssertCollection.

info

[character(1)]
See expect_that

label

[character(1)]
See expect_that

...

[any]
List of calls to check functions.

Functions

  • check_pkg_installed(): returns TRUE or the error message as a string.

  • assert_pkg_installed(): returns x invisibly or errors out.

  • test_pkg_installed(): returns TRUE or FALSE

  • expect_pkg_installed(): returns an testthat::expectation()

  • skip_if_pkg_not_installed2(): skips test if package is not installed. Same as testthat::skip_if_not_installed(), except using rlang::is_installed() under the hood.

See also

Other dependencies helper: is_installed2(), pkg_installed_but_not_via_loadall