To begin this assignment I created a simple dataset called students_df.

S3 Object System:
In S3, objects are associated with classes defined by their attributes.

S4 Object System:
In S4, objects are created using the new() function. I defined a class using setClass() and then created objects of that class with new():

- How to tell what OO system (S3 vs. S4) an object is associated with?
- S3 objects are associated with classes defined by their attributes, while S4 objects are created using formal classes defined by setClass().
2. How to determine the base type (like integer or list) of an object?
- You can use the class() function to determine the type of object, and typeof() function to determine the base type.
3. What is a generic function?
- A generic function in R is a function that has different implementations depending on the class of the object it is applied to. These functions typically dispatch methods based on the class of one or more of their arguments.
4. What are the main differences between S3 and S4?
- S3 is a simpler system based on attribute matching, whereas S4 is more formal and allows for explicit definition of classes with slots.
GitHub Repository:
Leave a comment