9CALLING FUNCTIONS

image

Before you start writing your own functions in R, it’s useful to understand how functions are called and interpreted in an R session. First, you’ll look at how variable names are compartmentalized in R. You’ll see R’s rules for naming arguments and objects, and how R searches for arguments and other variables when a function is called. Then you’ll look at some alternative ways to specify arguments when calling a function.

9.1 Scoping

To begin with, it’s important to understand R’s scoping rules, which determine how the language compartmentalizes objects and retrieves them in a given session. This framework also defines the situations ...

Get The Book of R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.