Chapter 9. Object-Oriented Programming
Many programmers believe that object-oriented programming (OOP) makes for clearer, more reusable code. Though very different from the familiar OOP languages like C++, Java, and Python, R is very much OOP in outlook.
The following themes are key to R:
Everything you touch in R—ranging from numbers to character strings to matrices—is an object.
R promotes encapsulation, which is packaging separate but related data items into one class instance. Encapsulation helps you keep track of related variables, enhancing clarity.
R classes are polymorphic, which means that the same function call leads to different operations ...