On Fri, Apr 01, 2005 at 01:29:01AM +0000, 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: jtk at cmp.uea.ac.uk |
| *NEW* WWW: http://www.cmp.uea.ac.uk/people/jtk |
*-----=< hierarchical systems are for files, not for humans >=-----*