Object-oriented programming in R
What is object and object-oriented programming (OOP)?
From J.Niño and F.Hosch (2008):
An object is “a software abstraction representing some data component to be manipulated by the system”.
Object-oriented programming (OOP) refers to “a method of software development in which the system is organized around data objects”.
Using OOP, we can use modular pieces of code to build complex models or large systems.
OOP systems in R
Based on H.Wickham (2019):
R supports OOP. S3, S4, Reference classes (RC), and R6 are the main OOP systems in R. An object from these systems contains both classes and methods. Classes include the type and data fields of an object. Methods are implemented in a class and define the behavior of the class.
Learn more about object oriented programming in H.Wickham’s book (Advanced R).
OOP applications in marine science field
- Fishery Library in R (S4 Classes)
- Data-Limited Methods Toolkit (S4 Classes)
- Objected-oriented Simulator of Marine Ecosystem (Java objects)
- Presentation on Object Oriented Programming in R (NOAA Internal only)