When f is called, a stack of 5 levels is built up to show.large.objects , which begins to evaluate the contents of the frames starting at the top.
f -> print -> system.time -> show.large.objects.stack -> show.large.objects
Level 1
f()
Everything is good here.
Level 2
print(system.time(show.large.objects.stack()))
When you call ls(.envir, all.names) in your frame, you get
[1] "..." "x"
of which ... missing, and throws error 3 when you call get on it, and x = system.time(show.large.objects.stack()) is currently evaluated and throws error 4.
Level 3
system.time(show.large.objects.stack())
whose ls gives you
[1] "expr" "gcFirst" "ppt" "time"
of which expr = show.large.objects.stack() is still evaluated and throws another 4 error.
Level 4
show.large.objects.stack()
whose ls does not contain fragmentary things and ends without errors.
Bottom row
show.large.frames() must be evalutad by itself, and not as an argument to any function, or it will cause errors. Why not let yourself print?
I found this very useful.
> debug(show.large.objects) > f() Browse[2]> lapply(sys.frames(), ls) [[1]] [1] "c" "d" [[2]] [1] "x" [[3]] [1] "expr" "gcFirst" "ppt" "time" [[4]] [1] "level" "skip.levels" [[5]] [1] "exclude" "threshold"
source share