is.global(n = 1)
A logical response.
A logical test to determine if the current environment is the global environment.
is.global()[1] FALSElapply(1:3, function(i) is.global())[[1]] [1] FALSE [[2]] [1] FALSE [[3]] [1] FALSEFUN <- function() is.global(); FUN()[1] FALSEFUN2 <- function(x = is.global(2)) x FUN2()[1] FALSEFUN3 <- function() FUN2(); FUN3()[1] FALSE