Summary
This chapter introduced basic ideas to specify optional execution of certain commands and the three basic loop constructs. We had to take a side trip to discuss the idea of scope and explore how R finds and interprets the meaning of a variable name. You can combine these ideas to create and implement algorithms and execute commands in a file.
This chapter also includes our first taste of object-oriented programming in the sense of an S3
class. We build on this idea in the next chapter where the S3
class is formally defined. In doing so, we explore how existing functions can be extended to accommodate arguments that include a class that we have constructed.