[R] How to 'mute' a function (like confint())

Prof Brian Ripley
Tue, 02 Aug 2011 09:46:22 -0000

See ?suppressMessages


On Tue, 2 Aug 2011, Remko Duursma wrote:

> Dear R-helpers,
>
> I am using confint() within a function, and I want to turn off the message
> it prints:
>
> x <- rnorm(100)
> y <- x^1.1+rnorm(100)
> nlsfit <- nls(y ~ g0*x^g1, start=list(g0=1,g1=1))
>
>> confint(nlsfit)
> Waiting for profiling to be done...
>        2.5%    97.5%
> g0 0.4484198 1.143761
> g1 1.0380479 2.370057
>
>
> I cannot find any way to turn off 'Waiting for. .."
>
> I tried
>
> options(max.print=0)
>
> and even
>
> sink(tempfile())
> confint(nlsfit)
> sink()
>
> This suppresses the printing of the table, but not the cat()-ing of the
> 'Waiting for...'.
>
> But it keeps writing this message; is there any way to mute it, for this
> function and more generally?
>
>
> thanks,
> Remko
>
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/How-to-mute-a-function-like-confint-tp3711537p3711537.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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