Skip to content
Prev 66846 / 398506 Next

about get stdout from other program

On Fri, Apr 01, 2005 at 01:29:01AM +0000, Michael S wrote:

            
For the scan function, it makes no difference whether you read from
a pipe or a regular file, both are represented by connections in R.

Temporary files should be avoided where possible, as they introduce
a source of data corruption that may remain unnoticed for quite some
time.

If your external program can be run by just one command line, use a
pipe, as in

    p = pipe("ls");
    scan(p, what = character(0));

Full filtering (i.e. if you need to write input into its stdin in addition
to reading output from its stdout) is currently not supported by R. I've
attempted to provide that, see

    http://www2.cmp.uea.ac.uk/~jtk/software/

Best regards, Jan