Skip to content

Instantly share code, notes, and snippets.

@yuttie
Created December 20, 2010 08:08
Show Gist options
  • Select an option

  • Save yuttie/748148 to your computer and use it in GitHub Desktop.

Select an option

Save yuttie/748148 to your computer and use it in GitHub Desktop.
trace and print caller's parent environment recursively
print.ancestor.envs <- function(e = environment(), level = 0) {
if (!identical(e, emptyenv())) {
print.ancestor.envs(parent.env(e), level - 1)
}
cat(sprintf("%3d: %s\n", level, environmentName(e)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment