Common S3 Generics not Provided by Base R Methods Related to Model Fitting

In order to reduce potential package dependencies and conflicts, generics provides a number of commonly used S3 generics.

BuildStatus Coveragestatus

generics is designed to help package authors reduce dependencies by providing a set of generic methods that can be imported. For example, if a package author wanted to include a tidy method for their object, they would have to import the broom package to do so. This would work but would potentially increase the number of package dependencies required to install and/or test the package.


To install generics from CRAN, use:


To install the development version, use:



generics is a simple, lightweight package that contains S3 generics to be used by other packages. Some examples are:

#> Attaching package: 'generics'
#> The following objects are masked from 'package:base':
#>     as.difftime, as.factor, as.ordered, intersect, is.element,
#>     setdiff, setequal, union
#> function (object, ...) 
#> {
#>     UseMethod("fit")
#> }
#> <bytecode: 0x7fafff33a2e0>
#> <environment: namespace:generics>
#> function (x, ...) 
#> {
#>     UseMethod("tidy")
#> }
#> <bytecode: 0x7fafff3f73b8>
#> <environment: namespace:generics>

To use generics with your package, we recommend that you import and re-export the generic(s) of interest. For example, if you want to provide a method for the S3 fit() method, you’d using the following roxygen2 code:

#' @importFrom generics explain
#' @export
#> function (x, ...) 
#> {
#>     UseMethod("explain")
#> }
#> <bytecode: 0x7faffdb7e0c8>
#> <environment: namespace:generics>

As an example, the recipes package defines a number of tidy() S3 methods by importing this package (whereas it previously depended on broom).


When searching for help on a method that is exported from generics by one or more packages, using ?method will show entries for all exported methods. If the version from generics is selected, the Methods section dynamically lists all specific methods exported by any loaded packages.


generics 0.0.1

First CRAN version

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.0.2 by Max Kuhn, 11 days ago

Report a bug at

Browse source code at

Authors: Max Kuhn [aut, cre] , Hadley Wickham [aut] , Davis Vaughan [aut] , RStudio [cph]

Documentation:   PDF Manual  

GPL-2 license

Imports methods

Suggests covr, pkgload, testthat, tibble

Imported by DeclareDesign, DesignLibrary, broom, customsteps, embed, estimatr, keras, parsnip, recipes, rsample, tidyposterior, yardstick.

Suggested by vctrs.

See at CRAN