How the R Language Does OOP

I wrote an article titled “How the R Language Does OOP” in the June 2016 issue of Visual Studio Magazine. See


The R language is most often used by data scientists and developers in an interactive mode. But you can write R programs for complex tasks, or to create a personal code library, or to create an R package for distribution to others.

Somewhat weirdly, R has several different OOP paradigms. Two older, but still common, OOP models are called S3 and S4 (the “S” because they were designed in the S language, the predecessor of R). A relatively newer OOP model is called the Reference Class (RC for short) model. The S3, S4, and RC models are built-in to the base R language.

In my article I describe a new OOP model called R6. It’s part of an add-on package. The R6 model is basically an extension of the RC model.


This entry was posted in Machine Learning, R Language. Bookmark the permalink.

2 Responses to How the R Language Does OOP

  1. Jules Wombat says:

    I am just trying to learn R from a C# background to support Machine Learning.
    I was pretty horrified to realise the within a Function, R will attempt to look outside of a function variable, for any variables not within its own local scope, and will process Global Environment variables. Not good.
    Still I guess in world today, OO and strong typing are for the old guys.

Comments are closed.