© Thomas Mailund 2017

Thomas Mailund, Advanced Object-Oriented Programming in R, 10.1007/978-1-4842-2919-4_7

7. R6 Classes

Thomas Mailund

(1)Aarhus N, Denmark

The last object system we will look at is the R6 system. This system is very unlike S3 and S4, and unusual for R in general, since it introduces mutable data. Data is usually immutable in R, and anything resembling object modification is really implemented by copying data and constructing new objects. The only things you can modify in R are environments; you cannot modify data. The R6 system, however, uses environments to give us objects we can modify. It’s unusual in R, but the semantics are then similar to how object-orientation is implemented in most other languages, where methods modify ...

Get Advanced Object-Oriented Programming in R: Statistical Programming for Data Science, Analysis and Finance 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.