Hi all,
Apologise if my question in naive, but I was trying to understand the source code of distinct function from dplyr, it looks something like this:
distinct <- function(.data, ..., .keep_all = FALSE) {
UseMethod("distinct")
}
Does this mean there is another function "distinct" that gets called by UseMethod?
In docs for UseMethods I found this: When a function calling UseMethod("fun")
is applied to an object with class attribute c("first", "second")
, the system searches for a function called fun.first
and, if it finds it, applies it to the object. If no such function is found a function called fun.second
is tried. If no class name produces a suitable function, the function fun.default
is used, if it exists, or an error results.
Implying "fun" or in our case "distinct" is an object? I am not sure how to understand this any help appreciated.
Thanks,