楼主: oliyiyi
2420 16

A Simple Guide to S3 Methods [推广有奖]

11
oliyiyi 发表于 2016-11-7 14:57:09
To summarize, the important feature of S3 methods worth noting is that only the first part, summary, is required to be used on these objects of different classes.

12
oliyiyi 发表于 2016-11-7 14:59:53
Hiding the trailing text after the . avoids the need to use a different summary function for every class. This means that one does not need to remember to use summary.lm for linear models, or summary.data.frame for data frames, or summary.aProposterousClassOfObject. By using S3 methods, cognitive load is reduced – you don’t have to think as much to remember what class an object is – and the commands are more intuitive. To get a summary of most objects, use summary, to plot most objects, use plot. Perhaps the most nifty feature of all is that a user can create their own S3 methods using the same functions such as summary and plot.

13
CDA-河南-洛阳 发表于 2016-11-7 15:11:47
太厉害了。。

14
oliyiyi 发表于 2016-11-7 15:24:40
Creating your own S3 method is not particularly difficult and is usually highly practical. A use case scenario for creating an S3 method is now discussed.

15
mmeng555 发表于 2016-11-7 16:41:15
支持!

16
janyiyi 发表于 2016-12-1 21:28:22
谢谢分享

17
花茶物语 发表于 2017-1-5 15:35:58
thanks for sharing

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-4 11:07