[R] capture.out(system())?

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Sep 5 10:02:51 CEST 2007


On Wed, 5 Sep 2007, Gustaf Rydevik wrote:

> On 9/4/07, Werner Wernersen <pensterfuzzer at yahoo.de> wrote:
>> Hi,
>>
>> I am trying to capture the console output of program I
>> call via system() but that always returns only
>> character(0).
>>
>> For example:
>> capture.output(system("pdflatex out.tex") )
>>
>> will yield:
>> character(0)
>>
>> and the output still written to the R console.
>>
>> Is there a command for intercepting this output?
>>
>> Thank you!
>>   Werner
>>
>
> ?sink()

That is used by capture.output() to capture R output, but this question is 
about output that never goes near R.

The answer is in ?system, but might depend on the unstated OS.  Arguments 
'intern' and 'show.output.on.console' are relevant.

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