[R] do.call, browser and traceback

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Feb 23 20:04:07 CET 2006


On Mon, 20 Feb 2006, hadley wickham wrote:

> A problem that I've encountered when using do.call a lot is very large
> stack traces, eg:
>
> f <- function(x) stop()
> do.call(error, mtcars)
> traceback()
> f <- function(x) browser()
> do.call(f, mtcars)

Did you mean that?  Both are errors.  Perhaps

f <- function(...) browser()
do.call(f, mtcars)

is an actual example of the idea.

What is being used is

 	Rprintf("Called from: ");
 	PrintValueRec(cptr->call,rho);

in src/main/main.c.  We could certainly allow an option to limit the 
deparse length, but I have to say that quite often the useful information 
is well down the list of arguments.  There is currently no user control.

>
> I have hacked together my own version of traceback to fix this by
> limiting the length of each line to 80 characters, but I can't see any
> way to do something similar for browser.  Any suggestions?
>
> Thanks,
>
> Hadley
>
> ______________________________________________
> R-help at 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
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list