Re: [R] New project: littler for GNU R

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Wed 27 Sep 2006 - 11:06:28 GMT

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.

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@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@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@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@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. Received on Wed Sep 27 21:17:26 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 27 Sep 2006 - 12:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.