[R] capturing output from Win 98 shell

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 12 17:18:27 CEST 2003


On 12 Aug 2003, Peter Dalgaard BSA wrote:

> "Simon Fear" <Simon.Fear at synequanon.com> writes:
> 
> > > system("COMMAND.COM /c dir /b", intern=T, show.output.on.console=T)
> > character(0)
> > > print(system("COMMAND.COM /c dir /b", intern=F,
> > show.output.on.console=T))
> > [1] 0
> > 
> > In both cases here a DOS window opens and lists a couple of hundred
> > files,
> > before giving the above output.
> 
> Does it help if you drop the "COMMAND.COM /c" bit??

No, but as `dir' is an internal command, it does help to use shell() and
not system().  It is shell() that is the equivalent of S-PLUS's dos()
command.

Not that R has dir() and list.files(), though.

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