Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ns_env

Get the namespace of a package


Description

Namespaces are the environment where all the functions of a package live. The parent environments of namespaces are the imports environments, which contain all the functions imported from other packages.

Usage

ns_env(x = caller_env())

ns_imports_env(x = caller_env())

ns_env_name(x = caller_env())

Arguments

x
  • For ns_env(), the name of a package or an environment as a string.

    • An environment (the current environment by default).

    • A function.

    In the latter two cases, the environment ancestry is searched for a namespace with base::topenv(). If the environment doesn't inherit from a namespace, this is an error.

env

A namespace environment.

Life cycle

These functions are experimental and may not belong to the rlang package. Expect API changes.

See Also


rlang

Functions for Base Types and Core R and 'Tidyverse' Features

v0.4.11
MIT + file LICENSE
Authors
Lionel Henry [aut, cre], Hadley Wickham [aut], mikefc [cph] (Hash implementation based on Mike's xxhashlite), Yann Collet [cph] (Author of the embedded xxHash library), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.