Re: [R] aggregate with cumsum

2011-02-26 Thread Uwe Ligges
On 25.02.2011 16:16, stephenb wrote: Bill, what will be the fastest way to output not just single lines but small data frames of about 60 rows? I prefer writing to a text file because the final output is large 47k times 60 rows and since I do not know the size of it I have to use rbind to bu

Re: [R] aggregate with cumsum

2011-02-25 Thread stephenb
Bill, what will be the fastest way to output not just single lines but small data frames of about 60 rows? I prefer writing to a text file because the final output is large 47k times 60 rows and since I do not know the size of it I have to use rbind to build the object which creates the memory p

Re: [R] aggregate with cumsum

2010-10-18 Thread William Dunlap
ject.org > Subject: Re: [R] aggregate with cumsum > > On Mon, Oct 18, 2010 at 9:55 AM, Bond, Stephen > wrote: > > Gabor, > > > > You are suggesting some very advanced usage that I do not > understand, but it seems this is not what I meant when I said loop. > >

Re: [R] aggregate with cumsum

2010-10-18 Thread Gabor Grothendieck
On Mon, Oct 18, 2010 at 9:55 AM, Bond, Stephen wrote: > Gabor, > > You are suggesting some very advanced usage that I do not understand, but it > seems this is not what I meant when I said loop. > I have a df with 47k rows and each of these is fed to a 'predict' which will > output about 62 rows

Re: [R] aggregate with cumsum

2010-10-18 Thread Bond, Stephen
om] Sent: Tuesday, October 12, 2010 4:16 PM To: Bond, Stephen Cc: r-help@r-project.org Subject: Re: [R] aggregate with cumsum On Tue, Oct 12, 2010 at 1:40 PM, Bond, Stephen wrote: > Hello everybody, > > Data is > myd <- data.frame(id1=rep(c("a","b","c"),e

Re: [R] aggregate with cumsum

2010-10-12 Thread Gabor Grothendieck
On Tue, Oct 12, 2010 at 1:40 PM, Bond, Stephen wrote: > Hello everybody, > > Data is > myd <- data.frame(id1=rep(c("a","b","c"),each=3),id2=rep(1:3,3),val=rnorm(9)) > > I want to get a cumulative sum over each of id1. trying aggregate does not > work > > myd$pcum <- aggregate(myd[,c("val")],list(

Re: [R] aggregate with cumsum

2010-10-12 Thread David Winsemius
On Oct 12, 2010, at 1:40 PM, Bond, Stephen wrote: Hello everybody, Data is myd <- data.frame(id1=rep(c("a","b","c"),each=3),id2=rep(1:3,3),val=rnorm(9)) I want to get a cumulative sum over each of id1. trying aggregate does not work myd$pcum <- aggregate(myd[,c("val")],list(orig=myd$id

Re: [R] aggregate with cumsum

2010-10-12 Thread Greg Snow
p-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Bond, Stephen > Sent: Tuesday, October 12, 2010 11:40 AM > To: r-help@r-project.org > Subject: [R] aggregate with cumsum > > Hello everybody, > > Data is > myd <- > data.frame(id1=rep(c(

Re: [R] aggregate with cumsum

2010-10-12 Thread Phil Spector
Stephen - In version R-2.11.1, I get aggregate(myd[,c("val")],list(orig=myd$id1),cumsum) orig x.1 x.2 x.3 1a -0.62754524 -1.16194135 -0.05975811 2b 0.21954618 -0.21355521 -0.62970082 3c -0.30296239 1.44111610 0.30121880 Since myd has several observat

[R] aggregate with cumsum

2010-10-12 Thread Bond, Stephen
Hello everybody, Data is myd <- data.frame(id1=rep(c("a","b","c"),each=3),id2=rep(1:3,3),val=rnorm(9)) I want to get a cumulative sum over each of id1. trying aggregate does not work myd$pcum <- aggregate(myd[,c("val")],list(orig=myd$id1),cumsum) Please suggest a solution. In real the dataframe