Hi 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
On Sunday 16 March 2003 09:16 pm, Robin Hankin wrote:> Hi > > I recently found a bug that was isomorphic to the following: > > ll1 <- 2 > increment <- function(x) > { > l11 <- 1You are not really using this variable (l11, not ll1) anywhere. Is that a typo? What exactly do you want to happen ?> 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?