[R] Lexical scoping

r@r.com r at r.com
Thu Nov 6 18:12:47 CET 2003


Comparing SPlus and R: a lesson in lexical scoping. If you consider to move to S, be aware of the following.

Consider the piece of code:

f <- function(x) {
  g <- function(y) {
    x + y
  }
  g(0)
}

What would be the result of calling f(10)? Try it in SPlus. They are too professional to make their product work well...

r.ar




More information about the R-help mailing list