Glossary
- Don’t Repeat Yourself (DRY)
A principle of computer programming that holds that general solutions should be set forth in one place and usable in many places, and that information needed in many places should be defined authoritatively in one place.
- Parameters of a Function
The parameters of a function (also called the formal arguments of the function) are the names that will be used in the body of the function to refer to the actual arguments supplied to the function when it is called.
- Argument
An argument for a function is a value that is assigned to one of the parameters of the function. (Sometimes arguments are called an actual arguments in order to distinguish then from parameters that are often called formal arguments.)
“It’s useful to distinguish between the formal arguments and the actual arguments of a function. The formal arguments are a property of the function, whereas the actual or calling arguments can vary each time you call the function.”
—H. Wickham, Advanced R Programming
- Body of a Function
The body of a function is the code that is executed when the function is called. In R, when the body consists of more than one expression then it appears inside of curly braces.
- Side-Effect
Any result produced outside of the run-time environment of a function, other than the value that the function returns.
- Default Value
A value for a parameter of a function that is provided when the function is defined. This value will become the value assigned to the parameter when the function is called, unless the user explicitly assigns some other value as the argument.
- Environment
An object stored in the computer’s memory that keeps track of name-value pairs.
- Active Environment
The environment that R will consult first in order to find the value of any name in an expression.
- Global Environment
The environment that is active when one is using R from the console.
- Parent Environment
The second environment (after the active environment) that R will search when it needs to look up a name.
- Run-time Environment (also called the “Evaluation Environment”)
A special environment that is created when a fuction is called and ceases to exist when the function finishes executing. It contains the values that are local to the function and the arguments of the function as well.
- Scoping
The process by which the computer looks up the object associated with a name in an expression.
- Search Path
The sequence of environments that the computer will consult in order to find an object associated with a name in an expression. The sequence begins with the active environment, followed by its parent environment, followed by the parent of the parent environment, and so on.
- Package
A bundle of R-code and data that is organized according to well-defined conventions and documented so that users can learn how to use the code and data.