2

I dont know how to debug structures like:

fun1 <- function(obj){
   a<-c(obj,4)
   c(a,5)
}

fun <- function(obj){
   a <- match.call()
   a[[1L]] <- fun1
   return(eval.parent(a))
}

I would like to know how to instruct the debug-mode to follow the call eval.parent(a) and jump into fun1.

Ari B. Friedman
  • 71,271
  • 35
  • 175
  • 235
Klaus
  • 1,946
  • 3
  • 19
  • 34
  • 1
    There's an awful lot of unnecessary code here. You will get better answers (and better understand the problem yourself) if you boil it down to a minimally reproducible answer: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Ari B. Friedman Jun 17 '12 at 11:26
  • I split up the most interesting part of my problem I hope that makes it easier to read it. – Klaus Jun 18 '12 at 16:40

1 Answers1

1

Per the debug help page: "If you want to debug a function not starting at the very beginning, use trace(..., at = *) or setBreakpoint."

> trace(eval.parent)

> fun(4)
trace: eval.parent(a)
[1] 4 4 5

Or perhaps you want to raise a warning and use that to trigger the browser. Hard to tell at this point what you are expecting.

IRTFM
  • 258,963
  • 21
  • 364
  • 487