On 16-Sep-09 21:17:10, David Winsemius wrote:
> On Sep 16, 2009, at 5:09 PM, OKB (not okblacke) wrote:
>> baptiste auguie wrote:
>>
>>> ?Reduce
>>>
>>> maybe
>>
>>      No, Reduce reduces an entire vector to a single value by  
>> repeatedly
>> combining adjacent elements.  I'm looking to convert a vector to  
>> another
>> vector where each element is some arbitrary aggregating function  
>> applied
>> to the first n elements of the vector.
> 
> Yes. You need to look again:
> 
> accumulate=FALSE by default, but is subject to change.-

Example:

  Reduce(function(x1,x2){x1^x2},c(4,3,2),accumulate=TRUE)
  # [1]    4   64 4096

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <ted.hard...@manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 16-Sep-09                                       Time: 23:17:28
------------------------------ XFMail ------------------------------

______________________________________________
R-help@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.

Reply via email to