use_import_from: Import a function from another package

View source: R/use_import_from.R

use_import_fromR Documentation

Import a function from another package

Description

use_import_from() imports a function from another package by adding the roxygen2 ⁠@importFrom⁠ tag to the package-level documentation (which can be created with use_package_doc()). Importing a function from another package allows you to refer to it without a namespace (e.g., fun() instead of package::fun()).

use_import_from() also re-documents the NAMESPACE, and re-load the current package. This ensures that fun is immediately available in your development session.

Usage

use_import_from(package, fun, load = is_interactive())

Arguments

package

Package name

fun

A vector of function names

load

Logical. Re-load with pkgload::load_all()?

Value

Invisibly, TRUE if the package document has changed, FALSE if not.

Examples

## Not run: 
use_import_from("glue", "glue")

## End(Not run)

r-lib/usethis documentation built on Nov. 28, 2024, 7:11 a.m.