[R] scoping rules

Robin Hankin r.hankin at auckland.ac.nz
Mon Mar 17 04:16:53 CET 2003


I recently found a bug that was isomorphic to the following:

ll1 <- 2
increment <- function(x)
  l11 <- 1
  return(x+ll1)   #bug here

Of course, R is obeying the scoping rules just fine, but I'm evidently
not setting the do.what.I.mean.not.what.I.say variable correctly.

Now, how do I avoid making this type of error? ... and what is the
best tool for tracking it down?


Robin Hankin, Lecturer,
School of Geography and Environmental Science
Tamaki Campus
Private Bag 92019 Auckland
New Zealand

r.hankin at auckland.ac.nz
tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042

More information about the R-help mailing list