Re: [R] Data frames, passing by value, and performance (Matt Shotwell)

2010-05-24 Thread biostatmatt
R is pretty smart about duplicating only when necessary. That is, arguments passed to a function are copy-on-write. Also, I think (someone more knowledgeable please correct if I'm wrong) it may be better to use the data frame, which is just a list internally, because if you only modify one column,

Re: [R] Data frames, passing by value, and performance

2010-05-24 Thread Gabor Grothendieck
If you don't modify the data frame in your function it won't physically make a new copy. On Mon, May 24, 2010 at 10:29 AM, wrote: > I understand that everything passed to an R function is passed "by > value".  This would seem to include data frames, which my current > application uses heavily, b

[R] Data frames, passing by value, and performance

2010-05-24 Thread gschultz
I understand that everything passed to an R function is passed "by value". This would seem to include data frames, which my current application uses heavily, both for storing program inputs, and holding intermediate and final results. In trying to get greater performance out of my R code, I am wo