check_and_load_package: Check if a package is installed and load it

View source: R/utils.R

check_and_load_packageR Documentation

Check if a package is installed and load it

Description

This function checks if a specified package is installed in the R environment. If the package is not installed, it will be automatically installed. After installation (if necessary), the package is loaded into the session.

Usage

check_and_load_package(package_name)

Arguments

package_name

A string with the name of the package to check and load.

Value

Invisibly returns 'TRUE' if the package is successfully loaded or installed and loaded. If the installation or loading fails, an error will be raised.

Examples

check_and_load_package("httr2")
check_and_load_package("xml2")

webdav documentation built on April 3, 2025, 10:13 p.m.