There's more…

Once you have created a new class for an object in R, you might think what is the use of the class? The answer is simple: you can utilize the class name to define a new generic function to perform a customized task. For example, you can define a generic function based on the class "robustSummary", and the new function will only give you the robust descriptive statistics such as median, MAD, and quartiles.

You can also use any conditional operation based on the condition satisfying the class name as follows:

    if(class(x)=="robustSummary") print("A new class has been defined")
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset