A) How do you tell what OO system (S3 vs. S4) an object is associated with?
I generally look at the object reference symbols. If the datasets have $ association then it is of S3 class, whereas, if it has # then it is of S4. Some package and their preloaded datasets have both classes.
B) How do you determine the base type (like integer or list) of an object?
I use str() or class() function on that object to determine its class association.
C) What is a generic function?
Generic functions are pre-loaded functions that come pre-loaded with every base R compilers. For examples, mean(), data.frame() and so on.
D) What are the main differences between S3 and S4?
E) In your GitHub, create two examples of S3 and S4.
Please see the code chunks below, and check out Lines 46-75.
Comments
Post a Comment