by Guangming Lang
You may wonder, “where is the function body?” You don’t see the function body because mean() is a generic function. Generic functions are used to implement the S3 object oriented system in R. Each generic function has one or many methods. For example, mean() has the following methods:
We cannot view the source code of a generic function, instead, we can view the source code of each generic.method function. For example, run the following commands to view the source of mean.default() and mean.Date() respectively.