Chapter 9. S4 Classes
This chapter is the third part in our introduction to programming. We examined S3
classes in the previous chapter. We will now examine S4
classes. The approach associated with S3
classes is more flexible, and the approach associated with S4
classes is a more formal and structured definition.
This chapter is roughly divided into four parts:
- Class definition: This section gives you an overview of how a class is defined and how the data (slots) associated with the class are specified
- Class methods: This section gives you an overview of how methods that are associated with a class are defined
- Inheritance: This section gives you an overview of how child classes that build on the definition of a parent class can be defined
- Miscellaneous commands: This section explains four commands that can be used to explore a given object or class