[R] New project: littler for GNU R

Duncan Murdoch murdoch at stats.uwo.ca
Wed Sep 27 14:22:32 CEST 2006


On 9/27/2006 7:06 AM, Duncan Murdoch wrote:
> Gabor Grothendieck wrote:
>> I think this is quoted out of context. I was referring to Duncan's post
>> which shows an example of piping R code.
>>   
> 
> No, that was Jeffrey's post that showed the pipe.  All that was in my 
> post was a question about why this isn't a patch to the standard R 
> script.  I don't think anyone has answered that, so I assume the reason 
> is that it just seemed easier to write a separate script than to change 
> the standard one.

I've been reminded offline that this was discussed a few months ago by R 
Core, and some tricky questions were raised.  Nobody had the time to 
address them before 2.4.0, but I think the hope is that we'll have time 
after it is released to nail down the decisions on this so that 
something makes it into 2.5.0.

Expect some more comments on the "tricky questions", but not for a 
couple of weeks:  2.4.0 is due out in 6 days, and that's the priority 
right now.

Duncan Murdoch


> 
> If someone else designs, documents and commits the necessary changes to 
> the standard script, I'd be happy to follow suit with the Windows R.exe.
> 
> Duncan Murdoch
>> On 9/26/06, Dirk Eddelbuettel <edd at debian.org> wrote:
>>   
>>> On 26 September 2006 at 22:17, Gabor Grothendieck wrote:
>>> | The real problem is that one wants to pipe the data in, not the
>>> | R source.  The idea is that one successively transforms the
>>> | data in successive elements of the pipeline.
>>>
>>> But that is what our filesize example does::
>>>
>>> | On 9/26/06, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
>>> | > On 9/26/2006 1:04 PM, Jeffrey Horner wrote:
>>> [...]
>>> | > >    But unlike bc(1), GNU R has a vast number of statistical
>>> | > >    functions. For example, we can quickly compute a summary() and show
>>> | > >    a stem-and-leaf plot for file sizes in a given directory via
>>> | > >
>>> | > >          $ ls -l /boot | awk '!/^total/ {print $5}' | \
>>> | > >               r -e 'fsizes <- as.integer(readLines());
>>> | > >                  print(summary(fsizes)); stem(fsizes)'
>>> | > >             Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>> | > >               13     512  110100  486900  768400 4735000
>>> | > >          Loading required package: grDevices
>>> | > >
>>> | > >            The decimal point is 6 digit(s) to the right of the |
>>> | > >
>>> | > >            0 | 00000000000000000011112223
>>> | > >            0 | 5557778899
>>> | > >            1 | 112233
>>> | > >            1 | 5
>>> | > >            2 |
>>> | > >            2 |
>>> | > >            3 |
>>> | > >            3 |
>>> | > >            4 |
>>> | > >            4 | 7
>>>
>>> Data to be processed on stdin, command via -e 'some long expression'.
>>>
>>> To make it simpler, here is a somewhat useless example of r piping into r
>>> (which I've indented for readability):
>>>
>>>  $  r -e 'set.seed(42); sapply(rnorm(5),function(x) cat(x,"\n"))' |  \
>>>                 r -e 'cat(sum(abs(as.numeric(readLines()))), "\n")'
>>>  3.335916
>>>
>>> Isn't that something where, to quote you, "one wants to pipe the data in, not
>>> the R source" ?
>>>
>>> Dirk
>>>
>>> --
>>> Hell, there are no rules here - we're trying to accomplish something.
>>>                                                  -- Thomas A. Edison
>>>
>>>     
>>
>> ______________________________________________
>> 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
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list