From alireza.s.mahani at gmail.com  Sat Jul 23 14:57:41 2011
From: alireza.s.mahani at gmail.com (Alireza Mahani)
Date: Sat, 23 Jul 2011 05:57:41 -0700 (PDT)
Subject: [Rd] Best practices for writing R functions
In-Reply-To: <CABdHhvHvB4vV5BymZfSguxCUH745nd6mrAk8EDw8Kk3RPN-C2Q@mail.gmail.com>
References: <1311341191873-3686674.post@n4.nabble.com>
	<4E2993CE.4020903@prodsyse.com>
	<CADwqtCONeEqXTTg0OyDj=OJWeQxNKBm79M=iBg1jdy6JtO_w0Q@mail.gmail.com>
	<6441154A9FF1CD4386AF4ABF141A056D265A9E9B@WMEXOSCD2-N1.bocad.bank-banque-canada.ca>
	<CABdHhvHvB4vV5BymZfSguxCUH745nd6mrAk8EDw8Kk3RPN-C2Q@mail.gmail.com>
Message-ID: <1311425861566-3688850.post@n4.nabble.com>

The fact that R doesn't automatically copy the function argument is very
useful when you mainly want to pass arguments to another function. Thanks to
all of you for mentioning this!

Another trick to reduce verbosity of code (and focus on algorithm logic
rather than boilerplate code) is to maintain a global copy of variables (in
the global environment) which makes them visible to all functions (where
appropriate, of course). Once the development and testing is finished, one
can tidy things up and modify the function prototypes, add lines for
unpacking lists inside functions, etc.

--
View this message in context: http://r.789695.n4.nabble.com/Best-practices-for-writing-R-libraries-tp3686674p3688850.html
Sent from the R devel mailing list archive at Nabble.com.



[Rd] Best practices for writing R functions
Alireza Mahani