f <- y~x
environment(f) # GlobalEnv
environment(empty_env(f)) # EmptyEnv
# \dontshow{
stopifnot(identical(environment(empty_env(f)), emptyenv()))
# }
environment(base_env(f)) # base package environment
# \dontshow{
stopifnot(identical(environment(base_env(f)), baseenv()))
# }
Run the code above in your browser using DataLab