This is merely a convenience function which signals to a reader that shorthand (python-esque) namespacing is occurring. This is equivalent to

d <- "dplyr"

but demonstrates that this is to be explicitly used in a shorthand namespace prefixing operation, such as d::select()

importAs(pkg = NULL, as = NULL)

pkg %importAs% as

Arguments

pkg

(character or symbol) name of a (hopefully installed) package

as

(character or symbol) symbol into which the package name should be assigned

Value

the symbol represented by as is assigned the character string pkg

Debugging

To turn on debug mode, in which a message is printed whenever shorthand namespacing is in effect, set the option options(importAs.debug = TRUE)

Examples

importAs("dplyr", "d")
#> Namespace 'dplyr' can be referenced as 'd'
dplyr %importAs% d
#> Namespace 'dplyr' can be referenced as 'd'