Learn R Programming

envnames (version 0.4.1)

check_environment: Check whether a string corresponds to the name of an environment

Description

The input string is checked as a valid environment name. The environment can be a named environment (system or package) or a user environment.

Usage

check_environment(x, envir)

Arguments

x

string to evaluate that may represent an environment

envir

environment where x should be evaluated first. If it is not found there it still searched for in the whole workspace.

Value

A list with two elements:

  • found whether the string contained in x is the name of an existing environment in the workspace

  • env_name the name of the environment (after stripping out any system environments such as globalenv(), baseenv() or a package environment) (for instance "globalenv()$env$env1" is returned as "env$env1"), or NULL if no environment was found corresponding to the name given in x.