Move or Clear a Created Frame

DESCRIPTION:
The function move.frame passes ownership of a created n frame to the frame to. Frame n continues to exist after the function has passed ownership to frame to. The function clear.frame deletes frame n and recovers the space allocated for frame n.

USAGE:
move.frame(n, to)
clear.frame(n)

REQUIRED ARGUMENTS:
n:
numeric index of the frame to be moved or cleared. In the case of move.frame, this must be the value of a previous call to new.frame.

OPTIONAL ARGUMENTS:
to:
optional numeric index of the frame in the evaluator that will take over parentage of frame n. By default, and usually, this is the parent of the function calling move.frame.

SIDE EFFECTS:
move.frame passes ownership of frame n to frame to. This means, in the typical case, that the function calling move.frame has created and used frame n, and wants that frame to continue its existence after the current frame returns. The complete procedure is a way to do a sequence of evaluations and pass back the result in an efficient way.

clear.frame deletes frame n, because it is no longer needed by the frame that owns it. This recovers the space allocated for that frame and its contents.


SEE ALSO:
new.frame , eval .

EXAMPLES:
# A function that evaluates 2 expressions and creates a frame
# containing the list data, maybe updated by the two expressions.
# Ownership is passed back to the caller of eval2() and the frame
# number is returned as value.

function eval2(expr1, expr2, data) { n <- new.frame(data) eval(expr1, n) eval(expr2, n) move.frame(n) n }