Skip to content

Macros versus functions

1 message · Murray Jorgensen

#
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