December 2017
Beginner to intermediate
470 pages
12h 29m
English
Classes in R6 are created with the R6Class() function, and we pass the name of the class and lists of public and private objects. These objects can be either attributes or methods. As you can see, building a class definition in R6 produces much cleaner code, which is put together in a single definition instead of the step-by-step process used in S3 and S4. This approach is more like what you can find in other popular languages.
You may specify how the constructor should behave by using the initialize method. This specific method will be called when an instance of the class is created.
There are two important differences between our names in the following definition and what we used for the S3 and S4 ...