Skip to Content
Modern R Programming Cookbook
book

Modern R Programming Cookbook

by Jaynal Abedin
October 2017
Beginner to intermediate
236 pages
7h 38m
English
Packt Publishing
Content preview from Modern R Programming Cookbook

How it works…

The newly created S4 object rStatsS4 displays the results into the R console as follows:

    > rStatsS4    An object of class "robustSummary"    Slot "median":    [1] 19    Slot "mad":     [1] 5.9304    Slot "q1":     [1] 16    Slot "q3":     [1] 23.75

This is the default method of the show() generic function. Once you have defined the method for the class robustSummary, the result will display as you defined within the method. Here is the result using the newly defined method for the robustSummary class:

    > show(rStatsS4)    The median is  19  with median absolute deviation (MAD) =  5.9304    First and Third Quartile is 16 and 23.75    > rStatsS4    The median is  19  with median absolute deviation (MAD) =  5.9304    First and Third Quartile is 16 and 23.75
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

R Cookbook, 2nd Edition

R Cookbook, 2nd Edition

JD Long, Paul Teetor

Publisher Resources

ISBN: 9781787129054Supplemental Content