powered by
A logical test to determine if the current environment is the global environment.
is.global(n = 1)
The number of generations to go back. If used as a function argument n should be set to 2.
A logical response.
http://stackoverflow.com/questions/18637656/detect-if-environment-is-global-enviroment
globalenv, parent.frame
globalenv
parent.frame
# NOT RUN { 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() # }
Run the code above in your browser using DataLab