eval(expression, local=T, parent=<<see below>>)
# a function that can simulate the S-PLUS program # from inside a function: see section 7.4.3 of # Becker, Chambers and Wilks try.S <- function() print(eval(parse(), F))# this test evaluates a function call, and makes assignments # into the caller's frame from the function called eval.test <- function() { x <- pi y <- runif(10) z <- 12 myfunc <- function() { # this assignment has no effect on parent frame's x x <- 1 assign("y", 2, frame = sys.parent(1)) eval(expression(z <- 3), local = sys.parent(1)) } old.values <- list(x = x, y = y, z = z) # creates new frame for myfunc eval(expression(myfunc()), local = T) new.values <- list(x = x, y = y, z = z) list(old.values = old.values, new.values = new.values) }