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

hadley wickham h.wickham at gmail.com
Tue Jun 24 14:06:06 CEST 2008


On Tue, Jun 24, 2008 at 1:15 PM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
> 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).

Or:

tc <- textConnection(NULL, "w")
sink(tc)
...
sink()
close(tc)

Or

capture.output(...)

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list