Re: [R] new data.frame summed by date

2009-08-28 Thread David Winsemius
The request for a date column results in a bit of redundancy beyond what tapply would have produced, but here it is as specified: > data.frame(dnames=names(tapply(X$PL_Pos, X$MyDate, sum)), dsums = tapply(X$PL_Pos, X$MyDate, sum) ) dnames dsums 2009-08-03 2009-08-03 174 2009

Re: [R] new data.frame summed by date

2009-08-28 Thread milton ruser
Puting my 2cents: newDF<-data.frame(aggregate(X$PL_Pos, list(X$MyDate), sum)) colnames(newDF)<-c("MyDate","PL_Pos_SUM") good luck milton On Fri, Aug 28, 2009 at 1:03 PM, jim holtman wrote: > Is this what you want: > > > aggregate(X$PL_Pos, list(X$MyDate), sum) > Group.1x > 1 2009-08-0

Re: [R] new data.frame summed by date

2009-08-28 Thread Mark Knecht
Jim, It looks exactly like what I wanted. Thanks! - Mark On Fri, Aug 28, 2009 at 10:03 AM, jim holtman wrote: > Is this what you want: > >> aggregate(X$PL_Pos, list(X$MyDate), sum) >      Group.1    x > 1  2009-08-03  174 > 2  2009-08-04  -26 > 3  2009-08-05  614 > 4  2009-08-06  318 > 5  2009

Re: [R] new data.frame summed by date

2009-08-28 Thread jim holtman
Is this what you want: > aggregate(X$PL_Pos, list(X$MyDate), sum) Group.1x 1 2009-08-03 174 2 2009-08-04 -26 3 2009-08-05 614 4 2009-08-06 318 5 2009-08-10 414 6 2009-08-11 -626 7 2009-08-12 544 8 2009-08-13 -106 9 2009-08-17 -146 10 2009-08-19 1004 11 2009-08-20 568 12 2

[R] new data.frame summed by date

2009-08-28 Thread Mark Knecht
Hi, I wonder if someone can suggest how to create a new data.frame Y from X where X$PL_Pos is summed by each unique X$MyDate. Y should end up with two (or more) columns Y$MyDate and Y$PL_Sum with its value being the cumsum of all the values in X for that date. - a 'daily cumsum'. Thanks, Mark