R

Writing a function has three big advantage

이부일 2018. 8. 24. 16:48

Writing a function has three big advantage over using copy-and-paste


1. You can give a function an evocative name that makes your code easier to understand.

2. As requirements change, you only need to update code in one place, instead of many.

3. You eliminate the chance of making incidental mistakes when you copy and paste (i.e. updating a variable name in one place, but not in another).


[출처] R for Data Science, Hadley Wickham & Garrett Grolemund, O'REILLY, p269