is_s3_generic()
compares name checks for both internal and regular
generics. is_s3_method()
builds names of all possible generics for that
function and then checks if any of them actually is a generic.
is_s3_generic(fname, env = parent.frame()) is_s3_method(fname, env = parent.frame())
fname | Name of function as a string. Need name of function because it's impossible to determine whether or not a function is a S3 method based only on its contents. |
---|---|
env | Environment to search in. |
is_s3_generic("mean")#> [1] TRUEis_s3_generic("sum")#> [1] TRUEis_s3_generic("[[")#> [1] TRUEis_s3_generic("unlist")#> [1] TRUEis_s3_generic("runif")#> [1] FALSEis_s3_method("t.data.frame")#> [1] TRUEis_s3_method("t.test") # Just tricking!#> [1] FALSEis_s3_method("as.data.frame")#> [1] FALSEis_s3_method("mean.Date")#> [1] TRUE