Chapter 9. Object-Oriented Programming

image with no caption

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 ...

Get The Art of R Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.