The modelr package provides functions that help you create elegant pipelines when modelling. It is designed primarily to support teaching the basics of modelling within the tidyverse, particularly in R for Data Science.

Status

modelr is stable: it has achieved its goal of making it easier to teach modelling within the tidyverse. For more general modelling tasks, check out the family of “tidymodel” packages like recipes, rsample, parsnip, and tidyposterior.

Getting started

Partitioning and sampling

The resample class stores a “reference” to the original dataset and a vector of row indices. A resample can be turned into a dataframe by calling as.data.frame(). The indices can be extracted using as.integer)(:

The class can be utilized in generating an exclusive partitioning of a data frame:

modelr offers several resampling methods that result in a list of resample objects (organized in a data frame):

Model quality metrics

modelr includes several often-used model quality metrics:

Interacting with models

A set of functions let you seamlessly add predictions and residuals as additional columns to an existing data frame:

For visualization purposes it is often useful to use an evenly spaced grid of points from the data:

Code of conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.