Displaying 1 result from an estimated 1 matches for "incras".
Did you mean:
incas
2010 Apr 01
4
Scope and assignment: baffling
Hi,
The code below creates a value, x$a, which depending on how you access it
evaluates to its initial value, or to what it's been changed to. The last
two lines should, I would have thought, evaluate to the same value, but they
don't.
f <- function () {
x <- NULL;
x$a <- 0;
x$get.a <- function () {
x$a;
};
x$increment.a <- function () {
x$a <<- x$a + 5;