Re: [R] Formula that includes previous row values

2009-02-23 Thread Pele
ay, February 23, 2009 1:59 PM >> To: r-help@r-project.org >> Subject: [R] Formula that includes previous row values >> >> >> Hi R users, >> >> Is there an easy way in R to generate the results table below using >> table 1 >> and the formula (s

Re: [R] Formula that includes previous row values

2009-02-23 Thread Greg Snow
boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Pele > Sent: Monday, February 23, 2009 1:59 PM > To: r-help@r-project.org > Subject: [R] Formula that includes previous row values > > > Hi R users, > > Is there an easy way in R to generate the resul

Re: [R] Formula that includes previous row values

2009-02-23 Thread Christos Hatzis
alf Of Pele > Sent: Monday, February 23, 2009 4:48 PM > To: r-help@r-project.org > Subject: Re: [R] Formula that includes previous row values > > > Hi Jorge - many thanks for you suggestion, but I am looking > for a way where I don't have to use a loop. I meant to >

Re: [R] Formula that includes previous row values

2009-02-23 Thread Pele
Hi Jorge - many thanks for you suggestion, but I am looking for a way where I don't have to use a loop. I meant to include that in my description. Thanks again! Jorge Ivan Velez wrote: > > Dear Pele, > Probably not the best way to proceed but it works: > > X<-read.table(textConnection("ID

Re: [R] Formula that includes previous row values

2009-02-23 Thread Jorge Ivan Velez
Dear Pele, Probably not the best way to proceed but it works: X<-read.table(textConnection("ID X2 1.001.00 2.000.00 3.001.00 4.003058 5.000.00 6.006.00"),header=TRUE) closeAllConnections() X x3<-0 for(i in 2:(nrow(X)+1)) x3<-c(x3, X$X2[i-1]+0.24*x3[i-1]) X$x3<-x3[-1]

[R] Formula that includes previous row values

2009-02-23 Thread Pele
Hi R users, Is there an easy way in R to generate the results table below using table 1 and the formula (simplified version of the real problem)? It would be easy if I knew the R equivalent of SAS's retain function, but could not find one. Thanks in Advance for any help! table1: ID X2