spod_assert_package: Checks if a package is installed and _informs_ the user if...

View source: R/internal-utils.R

spod_assert_packageR Documentation

Checks if a package is installed and informs the user if not

Description

This is wrapper around rlang::check_installed; instead of erroring out if the check fails it returns FALSE. However, unlike rlang::is_installed, it emits a message to the user.

Usage

spod_assert_package(...)

Arguments

...

Arguments passed on to rlang::check_installed

pkg

The package names. Can include version requirements, e.g. "pkg (>= 1.0.0)".

version

Minimum versions for pkg. If supplied, must be the same length as pkg. NA elements stand for any versions.

compare

A character vector of comparison operators to use for version. If supplied, must be the same length as version. If NULL, >= is used as default for all elements. NA elements in compare are also set to >= by default.

reason

Optional string indicating why is pkg needed. Appears in error messages (if non-interactive) and user prompts (if interactive).

action

An optional function taking pkg and ... arguments. It is called by check_installed() when the user chooses to update outdated packages. The function is passed the missing and outdated packages as a character vector of names.

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.


spanishoddata documentation built on June 16, 2025, 1:07 a.m.