Message-ID: <CABdHhvHvB4vV5BymZfSguxCUH745nd6mrAk8EDw8Kk3RPN-C2Q@mail.gmail.com>
Date: 2011-07-22T19:45:32Z
From: Hadley Wickham
Subject: Best practices for writing R functions
In-Reply-To: <6441154A9FF1CD4386AF4ABF141A056D265A9E9B@WMEXOSCD2-N1.bocad.bank-banque-canada.ca>
> But beware that a function makes a copy of the argument as soon as you try to modify something in that argument. So, for example, if you have a big list object as an argument and are going to modify one element in the list, you will save memory by making a local copy of the single element and modifying that. However, as others have said, I would not worry until you find there is a problem.
That's generally good practice in R - always modify the simplest
object possible.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/