...

/

What is a Class and its Types?

What is a Class and its Types?

In this lesson, we will learn what Classes and their types are and how to create them in the R language.

Introduction

Functional languages like R make use of the concepts of objects and classes. An object is comprised of a set of variables and functions. A class is a blueprint for an object. It refers to the set of attributes or functions common to all objects of a specific type.

Class Types

R includes 3 class systems, compared to other programming languages that have only one class system.

  • S3 class

  • S4 class

  • Reference class (RC)

Each has unique features and characteristics, so selecting one over the other comes down to personal preference. We provide a concise overview of them below.

S3 Class

...