A generic function is an encapsulation of any generic concept such as printing, calculating summary information of any R objects, creating graphs, and so on. The generic function does not perform any calculation, rather it just dispatches methods based on the class of the objects. In this recipe, you will create your own generic function and then define the method for the class robustStatistics.
Creating a generic function and defining a method for the S3 class
Getting ready
Suppose you want to create a generic function alternative to summary() in R. The name of the function is robSum(). The default action will be just to check the class and produce a message whether the input object has a certain class or not. In the second...