Learn R Programming

backports (version 1.1.0)

import: 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)

Arguments

pkgname
[character(1)] Name of the package where the backported function should be assigned.
obj
[character] Name of objects to assign, as character vector. If NULL, all backports which are not provided by R itself are assigned.

See Also

.onLoad

Examples

Run this code
## 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")
# }
## ---------------------------------------------

Run the code above in your browser using DataLab