import {backports} | R Documentation |
Import backported functions into your package
Description
Imports objects from backports into the namespace of other packages by assigning it during load-time. See examples for a code snippet to copy to your package.
Usage
import(pkgname, obj = NULL, force = FALSE)
Arguments
pkgname |
[ |
obj |
[ |
force |
[ |
See Also
Examples
## Not run:
# This imports all functions implemented in backports while the package is loaded
.onLoad <- function(libname, pkgname) {
backports::import(pkgname)
}
# This only imports the function "trimws"
.onLoad <- function(libname, pkgname) {
backports::import(pkgname, "trimws")
}
# This imports all backports from base and force-imports "hasName" from utils
.onLoad <- function(libname, pkgname) {
backports::import(pkgname)
backports::import(pkgname, "hasName", force = TRUE)
}
## End(Not run)
[Package backports version 1.5.0 Index]