[R] windowing

MacQueen, Don macqueen1 at llnl.gov
Wed Sep 11 16:42:13 CEST 2013


>From the help page for the aggregate function:


Compute Summary Statistics of Data Subsets

Description:

     Splits the data into subsets, computes summary statistics for
     each, and returns the result in a convenient form.




You might have to use cumsum() after the aggregation, if
"unbounded preceding" causes a cumulative sum to be calculated.

-Don
-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 9/9/13 11:58 AM, "Bond, Stephen" <Stephen.Bond at cibc.com> wrote:

>Is there a package or a command that does window aggregation like
>
>select
>sum(col1) over
>(partition by col2, col3 order by col4
>rows between unbounded preceding and current row) as sum1
>from table1 ;
>
>the above is Netezza syntax, but Postgre has same capability.
>
>Stephen B
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>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.



More information about the R-help mailing list