CHAPTER 7

image

User-Created Functions

User-created functions often make the life of an R user easier. If a repetitive task involves several different lines of code, creating a function to do the task saves time.

Designing plots is one example of when a user-created function makes sense. Plots often take several lines of code, and the design of a plot is usually an interactive process. Creating a function to design the plot is often much easier than using the up arrow and changing lines.

Another example of when a user-created function is useful is when a user wants to try out a statistical technique that is not available in the R packages. Often the ...

Get R Quick Syntax Reference now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.