Test If Environment is Global

Usage

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.

Test If Environment is Global

Value

A logical response.

Description

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

Examples

is.global()
[1] FALSE
lapply(1:3, function(i) is.global())
[[1]] [1] FALSE [[2]] [1] FALSE [[3]] [1] FALSE
FUN <- function() is.global(); FUN()
[1] FALSE
FUN2 <- function(x = is.global(2)) x FUN2()
[1] FALSE
FUN3 <- function() FUN2(); FUN3()
[1] FALSE

See also

globalenv, parent.frame

Author

Simon O'Hanlon and Tyler Rinker