search for: q_action

Displaying 1 result from an estimated 1 matches for "q_action".

Did you mean: g_action
2011 May 10
0
Debugging warnings
...CallingHandlers to provide more flexibility. The function below works, but I'm wondering if there's a more elegant way to figure out the correct frame to evaluate the action in - I'm currently counting back one from where warning was called. on_warning <- function(action, code) { q_action <- substitute(action) withCallingHandlers(code, warning = function(c) { for(i in seq_len(sys.nframe())) { f <- as.character(sys.call(i)[[1]]) if (f == "warning") break; } eval(q_action, sys.frame(i - 1)) }) } x <- 1 f <- function() { x <- 2...