Skip to content
Prev 24976 / 63424 Next

Implicit vs explicit printing and the call stack

On 5/13/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
Oh, I see - it is much more verbose, but CO2 has not been exploded out.
What is the suggested way to create such a promise? A closure? eg.

ggplot <- function(data) {
list(data = function() data)
}

A promise would have the desirable property of not storing a copy of
the data in the object, and you wouldn't need to update the plot
object if you changed the data in between creation and first plotting
(but not between first and second plotting).

Or delayed assign?

ggplot <- function(data) {
out <- new.env()
delayedAssign("data", data, assign.env=out)
out
}

Or something else?
Ok, I think I get it now.  Thanks for the detailed explanation.
Ok, that makes sense to me now.
Deparsing is probably the problem, as it needs to deparse a 55000 x 12
data.frame:
user  system elapsed
  2.912   0.015   2.961

which matches closely the delay I experience. In which case, I need to
fix my buggy print function, but what exactly is buggy about it?

Thanks again for your help,

Hadley