is.global: Test If Environment is Global

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/is.global.R

Description

A logical test to determine if the current environment is the global environment.

Usage

1
is.global(n = 1)

Arguments

n

The number of generations to go back. If used as a function argument n should be set to 2.

Value

A logical response.

Author(s)

Simon O'Hanlon and Tyler Rinker <tyler.rinker@gmail.com>

References

http://stackoverflow.com/questions/18637656/detect-if-environment-is-global-enviroment

See Also

globalenv, parent.frame

Examples

1
2
3
4
5
6
7
is.global()
lapply(1:3, function(i) is.global())
FUN <- function() is.global(); FUN()

FUN2 <- function(x = is.global(2)) x
FUN2()
FUN3 <- function() FUN2(); FUN3()

trinker/qdap documentation built on Sept. 30, 2020, 6:28 p.m.