Giter Site home page Giter Site logo

modelgenerics's Introduction

modelgenerics is designed to alleviate the situation where multiple packages use the same class. For example, if two packages have methods for a fit class, there will be conflicts when both packages are loaded. One approach would be for one package to import the other but this may result in many additional package dependencies during installation.

modelgenerics is a simple, lightweight packages that contains S3 and S4 generic definitions that other packages can use to avoid this problem. Some examples are:

> library(modelgenerics)
> 
> fit
standardGeneric for "fit" defined from package "modelgenerics"

function (object, ...) 
standardGeneric("fit")
<bytecode: 0x10889d930>
<environment: 0x108899b98>
Methods may be defined for arguments: object
Use  showMethods("fit")  for currently available ones.
> 
> train
standardGeneric for "train" defined from package "modelgenerics"

function (x, ...) 
standardGeneric("train")
<bytecode: 0x102993990>
<environment: 0x10298cb80>
Methods may be defined for arguments: x
Use  showMethods("train")  for currently available ones.

To use this in your package, It is suggested that, to do so by importing the package and re-exporting the method of interest. For example, if a S3 fit method were being used, the roxygen2 code to do this would be

#' @importFrom modelgenerics explain
#' @export
modelgenerics::explain

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

To install it modelgenerics, use:

require("devtools")
install_github("tidymodels/modelgenerics")

modelgenerics's People

Contributors

topepo avatar alexpghayes avatar

Watchers

Dimitri Grinkevich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.