[R] Suppressing output (e.g. from cat)

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jun 24 13:15:18 CEST 2008


On Tue, 24 Jun 2008, Richard Pearson wrote:

> Wacek, many thanks! I'm wondering however whether this will be problematic on 
> Windows (I have no windows box to hand to check this, but am creating a 
> package that I would like to be cross-platform)?

It will fail.  But

sink(tempfile())
...
sink()

is portable (and sink("nul:") works on Windows only).

> Richard.
>
> Wacek Kusnierczyk wrote:
>> Richard Pearson wrote:
>>> Is it possible to temporarily suspend output? I am using a function
>>> that gives lots of output using cat, that is not very informative. Is
>>> it possible to turn output off, run the function, then turn output
>>> back on again? I've looked at ?options and done various RSiteSearch()s
>>> but couldn't find a way to do this.
>>> 
>> 
>> sink("/dev/null")
>> 
>> ?sink
>> 
>> vQ
>
> -- 
> Richard D. Pearson             richard.pearson at postgrad.manchester.ac.uk
> School of Computer Science,    http://www.cs.man.ac.uk/~pearsonr
> University of Manchester,      Tel: +44 161 275 6178
> Oxford Road,                   Mob: +44 7971 221181
> Manchester M13 9PL, UK.        Fax: +44 161 275 6204

-- 
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