[R] Macros versus functions

Huntsinger, Reid reid_huntsinger at merck.com
Thu Nov 7 23:43:56 CET 2002


A nice article by Thomas Lumley on a sort of macro facility for
R appeared in the R Newsletter a few issues ago: 
http://cran.r-project.org/doc/Rnews/Rnews_2001-3.pdf

Reid Huntsinger

-----Original Message-----
From: Murray Jorgensen [mailto:maj at stats.waikato.ac.nz]
Sent: Thursday, November 07, 2002 4:14 PM
To: R-help
Subject: [R] Macros versus functions


R is a function-oriented language and functions have the advantage that 
they control unintended side effects of computations on the workspace. 
Still, there are times when I am using R when I want to make a large 
number of changes to the worksheet repeatedly and where the easiest way 
  seems to be to keep pasting in the same chunk of code, or to put it on 
a file and use source("filename"). So effectively R does have macros as 
well as functions.

Question: is the use of macros in this way 'bad practice' to be 
deprecated, and if so why? (If I decide that it is bad practice I will 
probably go on being bad, but I will try not to pass on bad habits to my 
students!)

Murray

-- 
Dr Murray Jorgensen      http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz                                Fax 7 838 4155
Phone  +64 7 838 4773 wk    +64 7 849 6486 home     Mobile 021 395 862

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._

------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message.  If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list