Methods belong to the object . You call them using the $ operator (e.g., my_object$do_something() ). The Core Systems 1. S3: The Pragmatic Standard
Encapsulation (private vs. public fields); reference semantics (modify objects in-place); method chaining. Advanced Object-Oriented Programming in R: Stat...
The first step in strategic selection is understanding the fundamental divide in R’s approach to objects: Methods belong to the object
S3 is R’s original, informal OOP system. It is essentially a list with a "class" attribute. reference semantics (modify objects in-place)
No formal validation; it relies on naming conventions (e.g., generic.class ). 2. S4: The Rigorous Contract
Strict type checking; multiple dispatch (methods can choose logic based on multiple arguments). Cons: High "ceremony" and steep learning curve. 3. R6: The Modern Powerhouse