[R] mlocal/mtrace inside a loop

Fred J. phddas at yahoo.com
Thu Mar 25 10:15:52 CET 2004


Hello
I need some help in figuring Bravington’s debugger
out.
Ok
I have 2 functions, fun1 and fun2 saved in a ASCII
file say filename is funs.
Fun1 has a loop which calls fun2, fun2 has a loop
which fails and I need to find out the value of the
variables of the fun2 and fun1 loops at the specific
iteration that fails. Both fun1 and fun2 loops will
iterate thousands of times so line by line debug is
not practical.
According to what I understood from > ?mlocal and the
Vol. 3/3, December 2003 R-news article "Debugging
Without (Too Many) Tears" by Mark Bravington. P.32
first column last paragraph, I did. "Which needs some
fixing and direction - thanks"

> source("funs")
> library(debug)
> debug(fun1)
data <- fun1(some.arguments")
 
in the file funs 
Was ....
fun1 <- function(arg1){ some looping code with calls
to fun2 }
fun2 <- function(arg2) {some more looping code}

Is now....to confirm to what I read
Fun1 <- function(arg1, nlocal=sys.parent()) 
mlocal(some more looping code)

I think I am implementing this package wrong and need
some help.

Thanks




More information about the R-help mailing list