Object oriented programming in R
In R programming, OOPs in R provide classes and objects as
its key tools to reduce and manage the complexity of the
program. R is a functional language that uses concepts of
OOPs. We can think of a class as a sketch of a car. It contains
all the details about the model_name, model_no, engine, etc.
Based on these descriptions we select a car. The car is the
object. Each car object has its own characteristics and
features. An object is also called an instance of a class and
the process of creating this object is called instantiation. In
R S3 and S4 classes are the two most important classes for
object-oriented programming. But before going discussing
these classes let’s see a brief about classes and objects.
Class and Object
Class is the blueprint or a prototype from which objects are
made by encapsulating data members and functions. An
object is a data structure that contains some methods that act
upon its attributes.