Re: [R] about get stdout from other program

2005-04-01 Thread Brian D Ripley
On Fri, 1 Apr 2005, Michael S wrote:

 if I want to use stdout from other language as my R program input ,which is
 the best way for design the API,using Pipe function or produce a temporary
 file,using scan function to read the file ?

A file for portability, since pipes do not work well on Windows 9x.

A pipe or fifo if you want to wait on output from another program.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] about get stdout from other program

2005-04-01 Thread Jan T. Kim
On Fri, Apr 01, 2005 at 01:29:01AM +, Michael S wrote:

 if I want to use stdout from other language as my R program input ,which is 
 the best way for design the API,using Pipe function or produce a temporary 
 file,using scan function to read the file ?

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
-- 
 +- Jan T. Kim ---+
 |*NEW*email: [EMAIL PROTECTED]   |
 |*NEW*WWW:   http://www.cmp.uea.ac.uk/people/jtk |
 *-=  hierarchical systems are for files, not for humans  =-*

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] about get stdout from other program

2005-03-31 Thread Michael S
Dear all R-helper,
if I want to use stdout from other language as my R program input ,which is 
the best way for design the API,using Pipe function or produce a temporary 
file,using scan function to read the file ?

thanks
Michael
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html