[R] determining a parent function name Hi, All, I'm writing a wrapper for stop that produces a popup window using tcltk.  Something like: error <- function(...) {    msg <- paste(..., sep = "")    if(!length(msg)) msg <- ""    if(require(tcltk, quiet = TRUE)) {      tt <- tktoplevel()      tkwm.title(tt, "Error")      tkmsg <- tktext(tt, bg = "white")      tkinsert(tkmsg, "end", sprintf("Error in %s: %s", "???", msg))      tkconfigure(tkmsg, state = "disabled", font = "Tahoma 12",                  width = 50, height = 3)      tkpack(tkmsg, side = "bottom", fill = "y")    }    stop(msg) } But, I would like to know from which function error() is called. For  example, if I have foo <- function() stop() bar <- function() error()  > foo() Error in foo() :  > bar() Error in error() : and in the tk window I get Error in ???: I need the output of bar (in the tk window only) to be Error in bar(): then it's clear where error is called. I'm not worried about the output  bar() produces on the console. Hope this makes sense. Thanks, --sundar ______________________________________________ R-help@stat.math.ethz.ch mailing list 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.