In the previous chapters, you learned the basics of R programming language, and understood the usage of vectors, matrices, lists, and data frames to represent data in different shapes. You also saw how we can use the built-in functions to solve simple problems. However, simply knowing these features does not help you solve every problem. Real-world data analysis usually involves careful and detailed transformation and aggregation of data, which can be done with a good variety of functions, whether they are built-in or provided by extension packages.
To best use these functions rather than let them confuse you with unexpected results, you need a basic but concrete understanding of how R functions work. In this chapter, we will cover the following topics:
Lazy evaluation
Copy-on-modify mechanism
Lexical scoping
Environments
If you understand these concepts and their roles in the code, most R code should appear highly predictable to you, which means higher productivity in both...