how to compare environment for equality in R how to compare environment for equality in R r r

how to compare environment for equality in R


Matthew Plourde's solution:

> identical(sys.frame(),.GlobalEnv)[1] TRUE

You can also check names, though this might be less reliable:

> environmentName(sys.frame())=="R_GlobalEnv"[1] TRUE