You can use the pipe command to read data:

 

msci <- read.table(pipe("python steve/python/msciintl.py"),sep=",",header=T,
as.is=T)

 

I use this metaphor quite a bit for loading data.

 

Steve Miller

 

 

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Robert Citek
Sent: Wednesday, May 10, 2006 9:02 PM
To: r-help@stat.math.ethz.ch
Subject: [R] R more Unix-like?

 

 

Is there a way to stream data into R so that it can be used in a  

command pipe?

 

Most Unix commands read data via standard input and read the script  

from the command line.  For example:

 

   $ seq 1 10 | sed -e 's/^/foo /'

   $ seq 1 10 | awk '{print "foo " $1}'

   $ seq 1 10 | perl -lane 'print "foo $F[0]"'

 

In contrast, R seems to read the script from standard input, thereby  

preventing streaming data through that file descriptor.  In reading  

through the man page for R and R-intro.html I haven't seen anything  

obvious to change this behaviour.  Is it possible?

 

Pointers to references would be greatly appreciated.

 

Regards,

- Robert

http://www.cwelug.org/downloads

Help others get OpenSource software.  Distribute FLOSS

for Windows, Linux, *BSD, and MacOS X with BitTorrent

 

______________________________________________

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


	[[alternative HTML version deleted]]


