Skip to content

This function figures out whether the input function is a regular/primitive/internal function, a internal/S3/S4 generic, or a S3/S4/RC method. This is function is slightly simplified as it's possible for a method from one class to be a generic for another class, but that seems like such a bad idea that hopefully no one has done it.

Usage

ftype(f)

Arguments

f

unquoted function name

Value

a character of vector of length 1 or 2.

Examples

ftype(`%in%`)
#> [1] "function"
ftype(sum)
#> [1] "primitive" "generic"  
ftype(t.data.frame)
#> [1] "S3"     "method"
ftype(t.test) # Tricky!
#> [1] "S3"      "generic"
ftype(writeLines)
#> [1] "internal"
ftype(unlist)
#> [1] "internal" "generic"