pkg_load: Load or unload R package(s)

View source: R/pkg_load.R

pkg_loadR Documentation

Load or unload R package(s)

Description

This function is a wrapper for require and detach. pkg_load checks to see if a package is installed, if not it attempts to install the package from CRAN. pkg_unload can detach one or more loaded packages.

Usage

pkg_load(..., pkg_names = NULL)

pkg_unload(..., pkg_names = NULL)

Arguments

...

Name(s) of package(s).

pkg_names

(Optional)Character vector containing packages to load or unload. Default uses NULL.

See Also

require, detach, p_load, p_unload

Examples

## Not run: 
pkg_load(data.table)
pkg_unload(data.table)

pkg_load(stringr,fst)
pkg_unload(stringr,fst)

pkg_load(pkg_names = c("data.table","fst"))
p_unload(pkg_names = c("data.table","fst"))

pkg_load(data.table,stringr,fst)
pkg_unload("all") # shortcut to unload all loaded packages

## End(Not run)

tidyfst documentation built on Sept. 16, 2024, 9:06 a.m.