[R] Pipe

Joe Stuart joe.stuart at gmail.com
Wed May 26 23:54:41 CEST 2010


Thanks for the info. I'll give that a try.



On May 25, 2010, at 5:36 PM, jim holtman <jholtman at gmail.com> wrote:

> readLines will read until it reached an end-of -file.  try
>
> readLines(con, n=1)
>
> to read one line at a time an then process it.
>
> On Tue, May 25, 2010 at 2:07 PM, Joe Stuart <joe.stuart at gmail.com>  
> wrote:
>> Hi,
>> I'm trying to use the pipe function to read data from another process
>> on my server.
>>
>> Here is the code I have tried.
>>
>> con <- pipe("/var/matlab/scripts/stream.pl")
>> while(con_read <- readLines(con)) {
>>  print(con_read)
>> }
>>
>> Problem is that the data from the perl script just keeps appending to
>> con_read and it never gets to the print function. Which makes sense,
>> but I would like to be able to perform calculations on con_read,  
>> while
>> the script continues to read from the perl script.
>>
>>
>> Any help is appreciated.
>>
>> -Joe
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> -- 
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?



More information about the R-help mailing list