Re: [R] memory management uestion [Broadcast]

2007-02-20 Thread Liaw, Andy
I don't see why making copies of the columns you need inside the loop is better memory management. If the data are in a matrix, accessing elements is quite fast. If you're worrying about speed of that, do what Charles suggest: work with the transpose so that you are accessing elements in the

Re: [R] memory management uestion [Broadcast]

2007-02-20 Thread Federico Calboli
Liaw, Andy wrote: I don't see why making copies of the columns you need inside the loop is better memory management. If the data are in a matrix, accessing elements is quite fast. If you're worrying about speed of that, do what Charles suggest: work with the transpose so that you are

Re: [R] memory management uestion [Broadcast]

2007-02-20 Thread Charles C. Berry
On Tue, 20 Feb 2007, Federico Calboli wrote: Liaw, Andy wrote: I don't see why making copies of the columns you need inside the loop is better memory management. If the data are in a matrix, accessing elements is quite fast. If you're worrying about speed of that, do what Charles

Re: [R] memory management uestion [Broadcast]

2007-02-20 Thread Federico Calboli
Charles C. Berry wrote: This is a bit different than your original post (where it appeared that you were manipulating one row of a matrix at a time), but the issue is the same. As suggested in my earlier email this looks like a caching issue, and this is not peculiar to R. Viz.

[R] memory management uestion

2007-02-19 Thread Federico Calboli
Hi All, I would like to ask the following. I have an array of data in an objetct, let's say X. I need to use a for loop on the elements of one or more columns of X and I am having a debate with a colleague about the best memory management. I believe that if I do: col1 = X[,1] col2 = X[,2]

Re: [R] memory management uestion

2007-02-19 Thread Charles C. Berry
On Mon, 19 Feb 2007, Federico Calboli wrote: Hi All, I would like to ask the following. I have an array of data in an objetct, let's say X. I need to use a for loop on the elements of one or more columns of X and I am having a debate with a colleague about the best memory management.

Re: [R] memory management uestion

2007-02-19 Thread Federico Calboli
Charles C. Berry wrote: Whoa! You are accessing one ROW at a time. Either way this will tangle up your cache if you have many rows and columns in your orignal data. You might do better to do Y - t( X ) ### use '-' ! for (i in whatever ){ do something using Y[ , i ] } My