[R] R more Unix-like?

Gabor Grothendieck ggrothendieck at gmail.com
Thu May 11 05:40:06 CEST 2006


Try this on Windows or the corresponding ls command on UNIX:

  readLines(pipe("cmd /c dir"))

On 5/10/06, Robert Citek <rwcitek at alum.calberkeley.org> wrote:
>
> 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 at 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
>




More information about the R-help mailing list