[R] Suppressing certain debugging output
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Dec 21 18:28:13 CET 2009
On Mon, 21 Dec 2009, Stuart Andrews wrote:
> keywords: debug, do.call, "debugging in", suppress, arguments, list, screen,
> console, output
>
> Hi,
>
> I would like to control the output to the console while debugging functions
> that are called by do.call( FCN, ARGUMENTS ) when the arguments are quite
> large. Is there a simple way to suppress (or compress) this output?
Yes. From ?options
‘deparse.max.lines’: controls the number of lines used when
deparsing in ‘traceback’, ‘browser’, and upon entry to a
function whose debugging flag is set. Initially unset, and
only used if set to a positive integer.
>
> Thanks,
> - Stu
>
>
> For example:
>
> ttt = function(x) { length(x) }; debug(ttt); do.call(ttt,
> list(x=rep(0,10)))
> ttt = function(x) { length(x) }; debug(ttt); do.call(ttt,
> list(x=rep(0,100)))
> ttt = function(x) { length(x) }; debug(ttt); do.call(ttt,
> list(x=rep(0,10000000)))
>
>
> The first line prints the following to the console ...
>
> debugging in: function(x) { length(x) }
> (x = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
> debug: {
> length(x)
> }
> Browse[1]>
>
>
> The second prints ...
>
> debugging in: function(x) { length(x) }
> (x = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
> debug: {
> length(x)
> }
> Browse[1]>
>
>
> Etc.
> Etc.
>
> ______________________________________________
> R-help at r-project.org 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.
--
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