Chapter 2. First Steps towards Programming in R

This chapter is a general introduction to classes, objects, and functions in R. Now, we now know that R is an object-oriented language. Conceptually, as any other language of its kind, R has three main elements, as follows:

  • Classes
  • Objects
  • Functions

This chapter will cover the following topics:

  • Object-oriented programming (OOP) concepts in R
  • Vectors and arrays
  • Lists
  • Decision making and looping constructs

Object-oriented programming concepts

As in any other object-oriented programming language, a class in R is an abstract definition of an object type with specific attributes associated to it. For instance, for an eventual dog class (which is a general definition of a dog), we could say that it has the color ...

Get Learning Shiny now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.