Which R Base Generic Has the Most Number of Methods
byGuangming Lang
1 min read
Categories
r
A generic (short for generic function) is a special type of function in R. R’s S3 system uses generics to decide which method to call. In other words, when it comes to the S3 system, “object oriented programming” specifically means “generic oriented programming” because S3 methods belong to generic functions instead of classes or objects.
Can you guess which generic in the base package has the most number of methods? It turns out the winner is | with 2596 methods. Didn’t expect it, right? I certainly did not. Well, here’s the R script I wrote to get the answer, run it youself and let me know what you find.