Skip to content

Returns information about all methods belong to a generic or a class. In S3 and S4, methods belong to a generic, but it is often useful to see what generics have been provided methods for a given class. These are wrappers around utils::methods(), which returns a lot of useful information in an attribute.

Usage

s3_methods_class(x)

s3_methods_generic(x)

s4_methods_class(x)

s4_methods_generic(x)

Arguments

x

Name of class or generic

Value

A tibble with columns generic, visible, class, visible, and source.

Examples

s3_methods_class("Date")
#> # A tibble: 37 × 4
#>    generic    class visible source             
#>    <chr>      <chr> <lgl>   <chr>              
#>  1 +          Date  TRUE    base               
#>  2 -          Date  TRUE    base               
#>  3 Axis       Date  FALSE   registered S3method
#>  4 Math       Date  TRUE    base               
#>  5 Ops        Date  TRUE    base               
#>  6 Summary    Date  TRUE    base               
#>  7 [          Date  TRUE    base               
#>  8 [<-        Date  TRUE    base               
#>  9 [[         Date  TRUE    base               
#> 10 as.POSIXct Date  TRUE    base               
#> # ℹ 27 more rows
s3_methods_generic("anova")
#> # A tibble: 8 × 4
#>   generic class   visible source             
#>   <chr>   <chr>   <lgl>   <chr>              
#> 1 anova   glm     FALSE   registered S3method
#> 2 anova   glmlist FALSE   registered S3method
#> 3 anova   lm      FALSE   registered S3method
#> 4 anova   lmlist  FALSE   registered S3method
#> 5 anova   loess   FALSE   registered S3method
#> 6 anova   mlm     FALSE   registered S3method
#> 7 anova   mlmlist FALSE   registered S3method
#> 8 anova   nls     FALSE   registered S3method

s4_methods_class("Date")
#> # A tibble: 4 × 4
#>   generic     class visible source
#>   <chr>       <chr> <lgl>   <chr> 
#> 1 coerce      Date  TRUE    ""    
#> 2 initialize  Date  TRUE    ""    
#> 3 show        Date  TRUE    ""    
#> 4 slotsFromS3 Date  TRUE    ""    
s4_methods_generic("anova")
#> # A tibble: 0 × 4
#> # ℹ 4 variables: generic <chr>, class <chr>, visible <lgl>, source <chr>