Hi all,
I met a problem while using the debug package, I have the following program:
mainfun<- function(){
beta<-1
result<-subfun(beta+x)
}
subfun<-function(expr){
y <- eval(expr, envir=list(x=c(1,2)),enclos = parent.frame())
return(y)
}
I have no problem using this program without calling the debug package. but once
I mtrace(subfun), the debugger can't find all the beta after entering subfun , and give
the message : "Error in beta : non-numeric argument to binary operator"
Is there anyway to get around ?
thanks a lot
happy new year
need help with debug package
2 messages · Tong Wang
I think I have figured out part of the answer, when I entered a debugger, the calling environment (parent frame) refers to the debugger program, instead of the mainfun( ). But is there anyway to solve this problem ? thanks ----- Original Message ----- From: Tong Wang <wangtong at usc.edu> Date: Wednesday, January 3, 2007 9:30 pm Subject: need help with debug package To: R help <r-help at stat.math.ethz.ch>
Hi all,
I met a problem while using the debug package, I have the
following program:
mainfun<- function(){
beta<-1
result<-subfun(beta+x)
}
subfun<-function(expr){
y <- eval(expr, envir=list(x=c(1,2)),enclos =
parent.frame()) return(y)
}
I have no problem using this program without calling the debug
package. but once
I mtrace(subfun), the debugger can't find all the beta after
entering subfun , and give
the message : "Error in beta : non-numeric argument to binary
operator"
Is there anyway to get around ?
thanks a lot
happy new year