{"id":19278171,"url":"https://github.com/r-lib/generics","last_synced_at":"2025-04-05T06:10:36.527Z","repository":{"id":37883921,"uuid":"137095400","full_name":"r-lib/generics","owner":"r-lib","description":"Common generic methods","archived":false,"fork":false,"pushed_at":"2023-10-30T21:46:34.000Z","size":1611,"stargazers_count":60,"open_issues_count":9,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T15:25:36.286Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://generics.r-lib.org/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-lib.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-12T15:55:26.000Z","updated_at":"2025-03-22T08:14:25.000Z","dependencies_parsed_at":"2024-06-18T20:46:43.173Z","dependency_job_id":"476aee41-985d-4ff8-8108-0af5b8bdff2e","html_url":"https://github.com/r-lib/generics","commit_stats":{"total_commits":156,"total_committers":11,"mean_commits":"14.181818181818182","dds":0.6602564102564102,"last_synced_commit":"387397154bb8488a0b6dfbcbba91b781d598ee0e"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgenerics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgenerics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgenerics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgenerics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/generics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294541,"owners_count":20915340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T21:08:36.343Z","updated_at":"2025-04-05T06:10:36.498Z","avatar_url":"https://github.com/r-lib.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(collapse = TRUE, comment = \"#\u003e\")\n```\n\n# generics\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/r-lib/generics/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/generics/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/r-lib/generics/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/generics?branch=main)\n\u003c!-- badges: end --\u003e\n\n`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. \n\n## Installation\n\nTo install `generics` from CRAN, use:\n\n```{r, eval = FALSE}\ninstall.packages(\"generics\")\n```\n\nTo install the development version, use:\n\n```{r, eval = FALSE}\n# install.packages(\"pak\")\npak::pak(\"r-lib/generics\")\n```\n\n## Usage\n\n`generics` is a simple, lightweight package that contains S3 generics to be used by other packages. Some examples are:\n\n```{r}\nlibrary(generics)\n\nfit\n\ntidy\n```\n\nTo 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 `explain()` method, you'd using the following `roxygen2` code:\n\n``` {r, eval = FALSE}\n#' @importFrom generics explain\n#' @export\ngenerics::explain\n```\n\nAs an example, the [recipes](https://github.com/tidymodels/recipes) package defines a number of `tidy()` S3 methods by importing this package (whereas it previously depended on `broom`). \n\n## Documentation\n\nWhen 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. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fgenerics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fgenerics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fgenerics/lists"}