[R] any way to make the code more efficient ?

2006-12-08 Thread Leeds, Mark \(IED\)
The code bekow works so this is why I didn't include the data to reproduce it. The loops about 500 times and each time, a zoo object with 1400 rows and 4 columns gets created. ( the rows represent minutes so each file is one day worth of data). Inside the loop, I keep rbinding the newly created

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread Ravi Varadhan
/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Leeds, Mark (IED) Sent: Friday, December 08, 2006 4:17 PM To: r-help@stat.math.ethz.ch Subject: [R] any way to make

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread Leeds, Mark \(IED\)
Subject: RE: [R] any way to make the code more efficient ? Using rbind almost always slows things down significantly. You should define the objects aggfxdata and fullaggfxdata before the loop and then assign appropriate values to the corresponding rows and/or columns. Ravi

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread Charles C. Berry
Save your intermediate results as a list of matrices. Then rbind them all at once using do.call. It looks like this will save 23 seconds (see below), if you are running on a PC like mine (AMD 2GHz, WinXP ). But I wonder, if 23 a mere seconds is all you save is this really worth worrying

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread Liaw, Andy
-help@stat.math.ethz.ch Subject: RE: [R] any way to make the code more efficient ? Using rbind almost always slows things down significantly. You should define the objects aggfxdata and fullaggfxdata before the loop and then assign appropriate values to the corresponding rows

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread David Farrar
? Thanks. -Original Message- From: Ravi Varadhan [mailto:[EMAIL PROTECTED] Sent: Friday, December 08, 2006 5:21 PM To: Leeds, Mark (IED); r-help@stat.math.ethz.ch Subject: RE: [R] any way to make the code more efficient ? Using rbind almost always slows things down significantly. You