Hello,
I'm wondering it is possible and if yes would it be desirable to modify
the return value of functions during evaluation.
I supposed this would be very useful during debugging
myfun <- function(x) {res <- x+3 ; browser() ; res}
let say I run the following function myfun(3) and drop in the browser. I then
happened to notice that I should
multiply <x> by 3 instead of adding. I was thinking to do return(x*3)
but the return value is still 6.
> myfun(3)
Called from: myfun(3)
Browse[1]>
debug at #1: res
Browse[2]> return(3*3)
[1] 6
>
This feature could be valuable if the following setting
function(){
tmp_res <- time_consuming_function_with_browser(param)
some_other_function(tmp_res)
}
Best regards,
Jeremie
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.