October 2017
Beginner to intermediate
236 pages
7h 38m
English
In R, generally if you write the object name into the console, then it automatically prints its internal elements. For example, take a look at the following code snippet:
x <- c(13, 21, 19, 18, 21, 16, 21, 24, 17, 18, 12, 18, 29, 17, 18, 11, 13, 20, 25, 18, 15, 19, 21, 21, 7, 12, 23, 31, 16, 19, 23, 15, 25, 19, 15, 25, 25, 16, 29, 15, 26, 29, 23, 24, 20, 19, 14, 27, 22, 26) class(x) <- "robustSummary"
Now, if you just type x in the R console, it will print all the items in the object x and its class name. In R, when you call an object into the R console, it actually looks for a method for the class of the given object. If there is no method available for that class, then it automatically calls print.default() and produces ...